A new Flexera Community experience is coming on November 25th. Click here for more information.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

WiseScript Package Editor - my first script

Ok this "Works" but just curious if I went about this the correct way?

Since I need to figure this kind of stuff out, would be nice to get the hang and understand it better.
This was an easy task. We utilize Altiris 7.1 SP2 MP1 and have since added Symantec System Recovery 2011 Management Option.
We have various sites and they want the ability to do a C: backup or All Drive Backup. This is easy.. you create 1 filter for each of those options but the trick is to have as little administration as possible. We do a custom inventory this way. You just simply add a regkey to the machine and inventory it up into Altiris then create dynamic filters off the Tech's Choices.

so easy..
hklm\software\bmsssr key with 2 keys ssrdrive and ssrserver
but there are 32 and 64bit machines.

can you see anything that is redundant or not needed?
like i said this works.just looking to see if i could of had it any cleaner.. oh and the REM is just for reference.. i know they are not needed and would get the script smaller..

Rem Set Variables to Blank
Set Variable 64BIT to
Set Variable CNAME to
Set Variable DONE to No
Set Variable SSRSERVER to
Set Variable SSRDRIVE to

Rem Get Hostname
Get Registry Key SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName place in Variable CNAME

Rem Get and Set 64bit
Get System Information into 64BIT

Rem If not 64bit
If 64BIT Equals "0" then
Rem Get registry keys
Get Registry Key SOFTWARE\BMSSSR place in Variable SSRDRIVE
Get Registry Key SOFTWARE\BMSSSR place in Variable SSRSERVER

Rem If 64bit
ElseIf 64BIT Equals "1" then
Rem Get registry keys
Get Registry Key SOFTWARE\Wow6432Node\BMSSSR place in Variable SSRDRIVE
Get Registry Key SOFTWARE\Wow6432Node\BMSSSR place in Variable SSRSERVER
End

Rem On screen dialog selector
Custom Dialog "LCS SSR Configuration Settings"

Rem If not 64bit
If 64BIT Equals "0" then
Rem Edit registry
Edit 2 registry keys

Rem If 64bit
ElseIf 64BIT Equals "1" then
Rem Edit registry
Edit 2 registry keys
End
(2) Replies
TeleFragger wrote:

can you see anything that is redundant or not needed?
like i said this works.just looking to see if i could of had it any cleaner..

It appears that you are always working with the 32-bit areas of the registry, at least in the Get Registry Key Value actions...If that is true, then you do not need to check different parts of the registry for 64-bit and 32-bit machines. The reason is that all WiseScripts are 32-bit and will automatically get redirected by 64-bit Windows to the Wow6432Node. Even our latest Flexera Software release of WiseScript, which includes 64-bit extensions, still produces 32-bit executables that will only look at the true 64-bit parts of the registry if you opt-into it (see the screenshots below.) So unless you told it to look in the 64-bit areas of the registry, there is no need for the two separate if statements.

Granted, I am making an assumption about the end of your WiseScript where you are editing 2 registry values and doing it differently for 32-bit and 64-bit Windows. I am assuming that it is the same situation as your Get Registry Key actions. If your intention is to edit the 32-bit area of the registry (the Wow6432Node on 64-bit Windows), then you need not do it differently…Windows will magically redirect (so long as you haven’t marked the radio button to edit the 64-bit area of the registry, as shown in the screenshots.)

The Get Registry Key Value action has a radio button that can force it to look at the 64-bit areas of the registry. As long as you don't use it, Windows will force it to see the Wow6432Node when running on 64-bit Windows.


The Edit Registry action also has a radio button that can force it to look at the 64-bit areas of the registry. As long as you don't use it, Windows will force it to edit the Wow6432Node when running on 64-bit Windows.




So your cleaner WiseScript would look like:

Rem Set Variables to Blank
Set Variable CNAME to
Set Variable DONE to No
Set Variable SSRSERVER to
Set Variable SSRDRIVE to

Rem Get Hostname
Get Registry Key SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName place in Variable CNAME

Rem Get registry keys
Get Registry Key SOFTWARE\BMSSSR place in Variable SSRDRIVE
Get Registry Key SOFTWARE\BMSSSR place in Variable SSRSERVER

Rem On screen dialog selector
Custom Dialog "LCS SSR Configuration Settings"

Rem Edit registry
Edit 2 registry keys
been a while since I have been on.. thanks for the tidbit! looks way better...

im now starting to look at different ways to do things.. so more to come.... but well noted on what you said here.. appreciate it..