Does WiseScript Editor 7.0 SP3 support 64-bit installs
Updated: 21 May 2010 | 34 comments
This issue has been solved. See solution.
Does WiseScript support 64-bit OS?
discussion Filed Under:
Does WiseScript support 64-bit OS?
Comments
Yes
Yes, it does
Regards
Erik
www.DinamiQs.com
Regards Erik www.DinamiQs.com Dinamiqs is the home of VirtualStorm (www.virtualstorm.org)
*************************************************************
If your issue has been solved, Please mark it as solved
***********
Sure? My experience is that
Sure?
My experience is that you can only create RegKeys under HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\...
the "32 Bit portion" for 32 bit applications.
When you configure creating a RegKey in Wise Script Editor 7.3.0.385 under
HKEY_LOCAL_MACHINE\SOFTWARE\MyKey
it actually would create that key under
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MyKey
It's not possible to create a key direktly under
HKEY_LOCAL_MACHINE\SOFTWARE\MyKey with Wise Script Editor, as this is a 32Bit application that obviously does not support 64 bit systems.
Or am I missing something?
So from my point of view you only can create 32Bit setup.exe that run under 64bit OS, but you can not create native 64bit setups and you can not access 64bit parts of the registry.
Regards,
Hans
BTW ... Windows Installer Editor DOES create REAL 64 bit apps ..
when you need to configure a RegKey on a 64bit OS under HKLM\SOFTWARE\...
like e.g.
HKEY_LOCAL_MACHINE\SOFTWARE\MyKey
you need to go to the component details for the "regkey-component" and select the option "64-bit component".
If you do no so the key would be created under
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MyKey
Regards,
Hans
Yes, it
Yes, it does
Regards
Erik
www.DinamiQs.com
Sorry Erik, but Wisescript does not support 64 bit installs. It only supports 32 bit installs within a 64 bit environment.
There is an enhancement request for Wisescript to be updated to handle true 64 bit operations, in the Altiris KB, but I consider it highly unlikely that this enhancement request will ever be actioned, as Windows Installer Editor (producing MSI files) is already capable of true 64 bit support.
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
WiseScript needs to support the 64bit registry, here's why
It is unfortunate that Symantec does not support reading and writing to the 64bit portion of the Win64 registry. We use Wise extensively at our organization and often need to read existing registry keys in order to gather information the script needs to make subsequent decisions.
As an example, when we install printer drivers for AutoCAD we enumerate the regkeys under HKLM\Software\Autodesk\AutoCAD to find all the versions and flavors of AutoCAD based products installed on the target machine so we can install or update the appropriate PC3 and PMP files and printer shortcuts for each installed application. Also, since an AutoCAD user can create any number of custom user profiles for AutoCAD, we must also enumerate those for each AutoCAD app installed on the target machine so we can update them as well.
Now that we have begun deploying 64bit Autodesk products on WinXP64 machines we must be able to perform the above tasks in the 64bit registry as well as the win32 registry. Windows Installer is not a solution for us since it does not appear to have a script action that reads registry keys. Even if it can, we can't take advantage of the regkey enumeration routines we have written as Wise User Defined Actions. Maybe we can stitch together some vbscript with MSI to accomplish what we need. I don't know. Looks like we have a lot of work to do. It would save us alot of time and headaches if instead Altiris provided full 64bitregistry capabilities in WiseScript.
workaround
I think I have a workaround. Since Wise can execute a VBScript and variables can be passed in either direction between the VBScript and the Wise script, we can have the Wise script call a VBScript which will have access to the 64bit registry. Now I just need to find the SetGetVariable.wse sample script so I can see how to pass the variables. There is no SetGetVariables.wse in my samples directory.
Yes we can!
But as EdT states, the Wise Script Editor (fav. choice for CA's) does not support 64Bit. The Windows Installer Editor does...
Cheers
Phil
WiseScript 64bit registry support
The product comparison table on the Altiris product cutsheet titled "Wise Installation Studio - Advanced Installation Authoring for Windows Installer and Wisescript" is misleading.
The table indicates that the Wise Installation Studio can author 64-bit installations. This is true, but incomplete. The Windows Installer Editor can, but not the WiseScript Package Editor.
So let's be pedantic
"The table indicates that the Wise Installation Studio can author 64-bit installations. This is true, but incomplete. The Windows Installer Editor can, but not the WiseScript Package Editor."
Which in summary means that "Wise Installation Studio can author 64-bit installations" - this is accurate and not at all misleading. How it does it does not come into the equation.
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
64-bit support
Dear EdT,
Re: Your comment "Which in summary means that "Wise Installation Studio can author 64-bit installations" - this is accurate and not at all misleading. How it does it does not come into the equation."
I beg to differ. How the product does so most certainly does come into the equation for organizations whose scripting codebase and expertise is Wise script and not MSI. One of the specific reasons we upgraded a seat of InstallBuilder 9 to Installation Studio 7 was to update our code base for 64-bit Windows. Fortunately, the new support for integrating VBScript with Wise script (providing a script actiona and allowing two way variable passing) provided a satisfactory fallback.
Symantec/Altiris would do its customers a service by making it clear in any literature claiming 64-bit support, that Wise scripts do not support 64-bit installations. Wise is an excellent product and We have alot of manhours insvested in Wise scripts. Please consider this a customer vote to move it forward into the 64-bit arena.
Respectfully,
Gene Evans
Woolpert, Inc.
There is a long standing enhancement request for this
Somewhere in the Altiris KB is a long standing enhancement request to update wisescript editor to offer true 64 bit capabilities. However, it would be foolish of me to imply that this request will ever be filled, as the wisescript editor has not been substantially modified in 10+ years - only some minor enhancements to allow passing of properties from MSI's and to interface with vbscript.
Yours is not the only vote for 64 bit capability, but now that Symantec are at the helm, it all comes down to budgets, and these are not being directed towards Wise at this time, as far as I can see. Therefore, don't shackle your organisation to a product that may not be able to meet your needs going forward, and invest some time and effort into bringing your MSI skills up to a higher level.
At one time, many of us had a lot investing in DOS applications, but things move on, and eventually we all have to move to newer technologies.
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
So delicately put, Ed. Ever
So delicately put, Ed. Ever considered a career in politics?
Don't know why 'x' happened? Want to know why 'y' happened? Use ProcMon and it will tell you.
Think about using http://www.google.com before posting.
Politics
Actually, I think my other half would make a better politician. I'd be more inclined to keep the SAS busy sorting out other politicians who p1ssed me off - and that is a list that Victor Meldrew would envy....
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
There is a longstanding enhancement request for this
Yes, looks like the writing is on the wall. We'll use bailing wire and duct tape with our current tools while we assess the best direction to take going forward. We may be forced to use MSI for our pure installs. Windows Powershell appears to hold some promise for general scripting. From what I've been reading it appears Microsoft is committed to giving Powershell deep and robust access to the Windows API's (.NET, WMI, etc.).
workaround updated
Turns out the stated workaround I posted earlier is not a solution. Apparently, although a VBScript will run as a 64-bit process on 64-bit Windows
when executed by WSH, when called using the 'Execute VBScript' action in a Wise script it only runs as a 32-bit process.
However, there is good news. WMI includes a provision to allow a 32-bit app to access the 64-bit registry. It is described as follows in the Microsoft
MSDN article titled Requesting WMI Data on a 64-bit Platform (http://msdn.microsoftcom/en-us/library/aa393067(VS85)aspx).
"By default, an application or script receives data from the corresponding provider when two versions of a providers exist. The 32-bit provider
returns data to a 32-bit application, including all scripts, and the 64-bit provider returns data to the 64-bit compiled applications. However,
an application or script can request data from the nondefault provider, if it exists, by notifying WMI through flags on method calls."
The flag named '__ProviderArchitecture' can be used to explicitly request access to the portion of the registry the application needs to read.
This flag can take an integer value of either 32 or 64.
".
In my VBScript I replaced this line of code...
'Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
'with this...
Set objCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
objCtx.Add "__ProviderArchitecture", 64
Set objLocator = CreateObject("Wbemscripting.SWbemLocator")
Set objServices = objLocator.ConnectServer("","root\default","","",,,,objCtx)
Set objReg = objServices.Get("StdRegProv")
I tested this solution on WinXP64, toggling the value between 32 and 64, and confirming the results matched what would be expected. It appears to work.
You could also consider using a VBScript custom action
Depending on what you are trying to do, you would use a vbscript custom action directly, rather than via Wisescript, which is inherently a 32 bit process.
The custom action attributes column includes a 4096 value for running the CA as 64 bit
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
You could also consider using a VBScript custom action
When you use the term "custom action", I'm guessing that you are referring to the functionality Wise has added to MSI scripting. I opened the MSI editor and saw a list of custom actions. Can we expect Wise scripting to support 64-bit sometime soon or do you recommend we start learning to script in MSI? I guess part of the equation here is where we are at in the lifecycles of the various tools. If Wisescript is on its way out, then I suppose we need to start learning MSI and begin the long process of mapping our scripts into the MSI format. Can you provide any insight into the future development of the Wisescript side of Installation Studio? Is it going to catch up with developments like Windows 64-bit OS, or is Altiris de-emphasizing it. Thanks for any direction you can provide.
There was a thread a few
There was a thread a few weeks ago about 64-bit support. The OP of that thread had, like you, a lot invested in WiseScript. Reading between the lines of what was said therein and the deafening silence from Altiris on the point, I believe it's safe to conclude that now is the time to look at alternative MSI authoring tools.
Don't know why 'x' happened? Want to know why 'y' happened? Use ProcMon and it will tell you.
Think about using http://www.google.com before posting.
Wisescript is not an MSI authoring tool
Since I'm feeling a tad pedantic today, I would point out that Wisescript is NOT an MSI authoring tool. Those with Wise Installation Studio 7 or Wise Package Studio 7 already have 64 bit capability where MSI authoring is concerned.
To my knowledge, there are no equivalent scripted installers that have been upgraded to 64 bit - most probably because Microsoft want everyone to use MSI technology and you won't get logo certification for any application installer that does not use MSI.
What may be worth a few hours of your time, is the WIX project, which provides a framework for creating MSI files from an XML script. WIX is free and is being developed on an ongoing basis, so may offer you a transition option.
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
There was a thread a few
Agreed.
'Get Registry Key Value' script action (64-bit)
I am working on a user defined script action to replace the built-in script action "Get Registry Key Value" with one that includes support for the 64-bit registry.
Here is the UDA:
item: Remark
Text=File: UDA Get Registry Key Value.wse
end
item: Remark
Text=Replacement for the Get Registry Key Value script action
end
item: Remark
Text=Written to work around the limitation of Wise's inability to access the 64-bit portion of the registry.
end
item: Remark
end
item: Remark
Text=The value of the registry key is returned in the variable specified by REGKEY_VALUE
end
item: Set Variable
Variable=REGKEY_VALUE
end
item: Get System Information
Variable=X64
Flags=00011000
end
item: Execute VBScript
Pathname=C:\Wise Scripts\User Defined Actions\UDA Get Registry Key Value.vbs
End
The exit portion of the UDA presents a dialog which asks (at compile time of the parent script) for the Registry Root (hive), the default value to return if nothing is found, the registry key path, the regisrty value name, the data type (REG_SZ, DWORD, etc), and the behavior on a 64-bit machine - ie. Whether to search the 32-bit or the 64-bit registry.
item: Custom Dialog Set
Name=Enumerate Regkeys
item: Dialog
Title=Get Registry Key Value
Width=193
Height=249
Font Name=Helv
Font Size=8
item: Push Button
Rectangle=109 211 144 226
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000010000000000000001
Text=OK
end
item: Push Button
Rectangle=148 211 183 226
Action=3
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000010000000000000000
Text=Cancel
end
item: Static
Rectangle=11 52 52 65
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Default Value:
end
item: Editbox
Control Name=defaultval
Rectangle=62 51 183 65
Variable=DEFAULTVAL
Help Context=16711680
Enabled Color=00000000000000001111111111111111
Create Flags=01010000100000010000000010000000
Text=%DEFAULTVAL%
end
item: Static
Rectangle=4 8 185 42
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Returns the value of the specified registry key. Unlike the built-in 'Get Registry Key Value' script action, this user defined action can access both the 32-bit and 64-bit portions of the Windows registry. the value is returned in the variable named REGKEY_VALUE.
end
item: Static
Rectangle=11 85 52 99
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Value Name:
end
item: Static
Rectangle=11 69 52 83
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Registry Key:
end
item: Editbox
Control Name=regkey
Rectangle=62 68 183 82
Variable=REGKEY
Help Context=16711680
Enabled Color=00000000000000001111111111111111
Create Flags=01010000100000010000000010000000
Text=%REGKEY%
end
item: Radio Button
Control Name=regroot
Rectangle=11 116 101 179
Variable=REGROOT
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000010000000000001001
Text=HKEY_CLASSES_ROOT
Text=HKEY_CURRENT_USER
Text=HKEY_LOCAL_MACHINE
Text=HKEY_USERS
Text=HKEY_CURRENT_CONFIG
Text=
end
item: Static
Control Name=Root
Rectangle=5 110 106 183
Action=3
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000001000
end
item: Static
Rectangle=11 106 28 117
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Root
end
item: Editbox
Control Name=regvalname
Rectangle=62 85 183 99
Variable=REGVALNAME
Help Context=16711680
Enabled Color=00000000000000001111111111111111
Create Flags=01010000100000010000000010000000
Text=%REGVALNAME%
end
item: Radio Button
Control Name=regvaltype
Rectangle=118 116 179 179
Variable=REGVALTYPE
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000010000000000001001
Text=Binary
Text=String
Text=Expanded String
Text=Multi String
Text=DWORD
Text=QWORD
Text=
end
item: Static
Control Name=Root
Rectangle=112 110 183 183
Action=3
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000001000
end
item: Static
Rectangle=118 106 151 116
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Value Type
end
item: Radio Button
Control Name=regsearchtype
Rectangle=11 199 93 223
Variable=REGSEARCHTYPE
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000010000000000001001
Text=Search the 64-bit registry
Text=Search the 32-bit registry
Text=
end
item: Static
Rectangle=5 192 97 226
Action=3
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000001000
end
item: Static
Rectangle=11 188 73 198
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Behavior on 64-bit OS
end
item: If/While Statement
Variable=DLG_EVENT_TYPE
Value=VERIFY
end
item: End Block
end
end
end
The UDA then executes the folllowing VBScript that uses WMI to access the registry and return the specified value.
Dim strComputer, strOS64, strRegRoot, strRegKeyPath, strRegValName
Dim strRegValType, strDefaultVal, strValue, strRegSearchType
strComputer = "."
strOS64 = GetVariable("X64")
strRegRoot = GetVariable("REGROOT")
strRegKeyPath = GetVariable("REGKEY")
strRegValName = GetVariable("REGVALNAME")
strRegValType = GetVariable("REGVALTYPE")
strDefaultVal = GetVariable("DEFAULTVAL")
strRegSearchType = GetVariable("REGSEARCHTYPE")
Select Case strRegRoot
Case "A" strRegRoot = &H80000000 'HKEY_CLASSES_ROOT
Case "B" strRegRoot = &H80000001 'HKEY_CURRENT_USER
Case "C" strRegRoot = &H80000002 'HKEY_LOCAL_MACHINE
Case "D" strRegRoot = &H80000003 'HKEY_USERS
Case "E" strRegRoot = &H80000005 'HKEY_CURRENT_CONFIG
Case Else strRegRoot = "not set"
End Select
Set objCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
'If we are on a 64-bit OS...
If strOS64 = "1" Then
'If instructed to search the 32-bit registry...
If strRegSearchType = "A" Then
objCtx.Add "__ProviderArchitecture", 32
'If instructed to search the 64-bit registry...
Elseif strRegSearchType = "B" Then
objCtx.Add "__ProviderArchitecture", 64
End If
Set objLocator = CreateObject("Wbemscripting.SWbemLocator")
Set objServices = objLocator.ConnectServer("","root\default","","",,,,objCtx)
Set objReg = objServices.Get("StdRegProv")
'Else if we are on a 32-bit OS...
Else
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
End If
Select Case strRegValType
Case "A"
objReg.GetBinaryValue strRegRoot, strRegKeyPath, strRegValName, strValue
Case "B"
objReg.GetStringValue strRegRoot, strRegKeyPath, strRegValName, strValue
Case "C"
objReg.GetExpandedStringValue strRegRoot, strRegKeyPath, strRegValName, strValue
Case "D"
objReg.GetMultiStringValue strRegRoot, strRegKeyPath, strRegValName, strValue
Case "E"
objReg.GetDWORDValue strRegRoot, strRegKeyPath, strRegValName, strValue
Case "F"
objReg.GetQWORDValue strRegRoot, strRegKeyPath, strRegValName, strValue
Case Else strValue = ""
End Select
SetVariable "REGKEY_VALUE", strValue
However, the variables defined in the dialog of the UDA (REGROOT, REGKEY, REGVALNAME, REGVALTYPE, DEFAULTVAL, REGSEARCHTYPE) never get passed to the VBScript. If I move the assignments from the Exit portion to the mainline portion of the UDA or to the parent script that uses the UDA, the values get passed to the VBScript, but not if I assign the values in the Exit portion of the UDA. Of course, moving the assignments out of the dialog box defeats the purpose of the UDA, which is to provide a compact, single-line script action to get a registry value.
I don't understand why the variable values don't get passed to the VBScript, because the parent script can see them, so one would think that the variables would be available to the GetVariable() function in the VBScript. I know the parent script can see them because as a test I have separated the VBScript from the UDA and put an Execute VBScript into the parent script after the UDA script action and then inserted between them a Display Message action to see if the variables have been populated before the VBSCript is executed.
Here is the parent test script:
item: Custom Script Item
Filename=UDA Get Registry Key Value.wse
Variable Name1=REGVALTYPE
Variable Value1=B
Variable Name2=REGVALNAME
Variable Value2=ProductName
Variable Name3=REGROOT
Variable Value3=C
Variable Name4=REGKEY
Variable Value4=Software\Autodesk\AutoCAD\R17.1\ACAD-6002:409
Variable Name5=REGSEARCHTYPE
Variable Value5=A
Variable Name6=DEFAULTVAL
Variable Value6=nothing
end
item: Display Message
Title=variable values before running VBScript
Text=X64 = %X64%
Text=REGROOT = %REGROOT%
Text=REGVALTYPE = %REGVALTYPE%
Text=REGSEARCHTYPE = %REGSEARCHTYPE%
Text=REGKEY_VALUE = %REGKEY_VALUE%
end
item: Execute VBScript
Pathname=C:\Wise Scripts\User Defined Actions\UDA Get Registry Key Value.vbs
end
item: Display Message
Title=variable values after running VBScript
Text=X64 = %X64%
Text=REGROOT = %REGROOT%
Text=REGVALTYPE = %REGVALTYPE%
Text=REGSEARCHTYPE = %REGSEARCHTYPE%
Text=REGKEY_VALUE = %REGKEY_VALUE%
end
item: Display Message
Title=result
Text=REGKEY_VALUE = %REGKEY_VALUE%
end
Any ideas appreciated. If I get this working, I'll post it to this forum.
Best regards,
Gene Evans
Woolpert, Inc.
'Get Registry Key Value' script action (64-bit)
Here is a corrected version which works:
The Title of the script:
Get Registry Key %REGROOT%\%REGKEY%\%REGVALNAME% Place into variable %RETURNVAL%
The mainline script of the UDA:
item: Remark
Text=File: UDA Get Registry Key Value.wse
end
item: Remark
Text=Replacement for the Get Registry Key Value script action
end
item: Remark
Text=Written to work around the limitation of Wise's inability to access the 64-bit portion of the registry.
end
item: Remark
end
item: Remark
Text=The value of the registry key is returned in the variable specified by REGKEY_VALUE
end
item: Get System Information
Variable=X64
Flags=00011000
end
item: Set Variable
Variable=%RETURNVAL%
end
item: Set Variable
Variable=REGKEY_VALUE
end
item: Set Variable
Variable=REGROOT
Value=%REGROOT%
end
item: Set Variable
Variable=REGKEY
Value=%REGKEY%
end
item: Set Variable
Variable=REGVALNAME
Value=%REGVALNAME%
end
item: Set Variable
Variable=REGVALTYPE
Value=%REGVALTYPE%
end
item: Set Variable
Variable=DEFAULTVAL
Value=%DEFAULTVAL%
end
item: Set Variable
Variable=REGSEARCHTYPE
Value=%REGSEARCHTYPE%
end
item: Execute VBScript
Pathname=C:\Wise Scripts\User Defined Actions\UDA Get Registry Key Value.vbs
end
item: Set Variable
Variable=%RETURNVAL%
Value=%REGKEY_VALUE%
end
The Exit script dialog of the UDA:
item: Custom Dialog Set
Name=Enumerate Regkeys
item: Dialog
Title=Get Registry Key Value
Width=193
Height=302
Font Name=Helv
Font Size=8
item: Push Button
Rectangle=109 233 144 248
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000010000000000000001
Text=OK
end
item: Push Button
Rectangle=148 233 183 248
Action=3
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000010000000000000000
Text=Cancel
end
item: Static
Rectangle=11 74 52 87
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Default Value:
end
item: Editbox
Control Name=defaultval
Rectangle=62 73 183 87
Variable=DEFAULTVAL
Help Context=16711680
Enabled Color=00000000000000001111111111111111
Create Flags=01010000100000010000000010000000
Text=%DEFAULTVAL%
end
item: Static
Rectangle=4 8 185 42
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Returns the value of the specified registry key. Unlike the built-in 'Get Registry Key Value' script action, this user defined action can access both the 32-bit and 64-bit portions of the Windows registry. the value is returned in the variable named RETURNVAR.
end
item: Static
Rectangle=11 107 52 121
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Value Name:
end
item: Static
Rectangle=11 91 52 105
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Registry Key:
end
item: Editbox
Control Name=regkey
Rectangle=62 90 183 104
Variable=REGKEY
Help Context=16711680
Enabled Color=00000000000000001111111111111111
Create Flags=01010000100000010000000010000000
Text=%REGKEY%
end
item: Radio Button
Control Name=regroot
Rectangle=11 138 101 201
Variable=REGROOT
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000010000000000001001
Text=HKEY_CLASSES_ROOT
Text=HKEY_CURRENT_USER
Text=HKEY_LOCAL_MACHINE
Text=HKEY_USERS
Text=HKEY_CURRENT_CONFIG
Text=
end
item: Static
Control Name=Root
Rectangle=5 132 106 205
Action=3
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000001000
end
item: Static
Rectangle=11 128 28 139
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Root
end
item: Editbox
Control Name=regvalname
Rectangle=62 107 183 121
Variable=REGVALNAME
Help Context=16711680
Enabled Color=00000000000000001111111111111111
Create Flags=01010000100000010000000010000000
Text=%REGVALNAME%
end
item: Radio Button
Control Name=regvaltype
Rectangle=118 138 179 201
Variable=REGVALTYPE
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000010000000000001001
Text=Binary
Text=String
Text=Expanded String
Text=Multi String
Text=DWORD
Text=QWORD
Text=
end
item: Static
Control Name=Root
Rectangle=112 132 183 205
Action=3
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000001000
end
item: Static
Rectangle=118 128 151 138
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Value Type
end
item: Radio Button
Control Name=regsearchtype
Rectangle=11 221 93 245
Variable=REGSEARCHTYPE
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000010000000000001001
Text=Search the 64-bit registry
Text=Search the 32-bit registry
Text=
end
item: Static
Rectangle=5 214 97 248
Action=3
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000001000
end
item: Static
Rectangle=11 210 73 220
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Behavior on 64-bit OS
end
item: Combobox
Rectangle=62 56 183 80
Variable=RETURNVAL
Enabled Color=00000000000000001111111111111111
Create Flags=01010000001000010000001101000010
Text=%_VAR_LIST_%
Text=
end
item: Static
Rectangle=11 57 58 70
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Variable Name:
end
item: If/While Statement
Variable=DLG_EVENT_TYPE
Value=VERIFY
end
item: End Block
end
end
end
and the associated VBScript:
Dim strComputer, strOS64, strRegRoot, strRegKeyPath, strRegValName
Dim strRegValType, strDefaultVal, strValue, strRegSearchType
strComputer = "."
strOS64 = GetVariable("X64")
strRegRoot = GetVariable("REGROOT")
strRegKeyPath = GetVariable("REGKEY")
strRegValName = GetVariable("REGVALNAME")
strRegValType = GetVariable("REGVALTYPE")
strDefaultVal = GetVariable("DEFAULTVAL")
strRegSearchType = GetVariable("REGSEARCHTYPE")
'MsgBox "X64 = " & strOS64 & vbCrlf _
'& "REGROOT = " & strRegRoot & vbCrlf _
'& "REGKEY = " & strRegKeyPath & vbCrlf _
'& "REGVALNAME = " & strRegValName & vbCrlf _
'& "REGVALTYPE = " & strRegValType & vbCrlf _
'& "DEFAULTVAL = " & strDefaultVal & vbCrlf _
'& "REGSEARCHTYPE = " & strRegSearchType
Select Case strRegRoot
Case "A" strRegRoot = &H80000000 'HKEY_CLASSES_ROOT
Case "B" strRegRoot = &H80000001 'HKEY_CURRENT_USER
Case "C" strRegRoot = &H80000002 'HKEY_LOCAL_MACHINE
Case "D" strRegRoot = &H80000003 'HKEY_USERS
Case "E" strRegRoot = &H80000005 'HKEY_CURRENT_CONFIG
Case Else strRegRoot = "not set"
End Select
Set objCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
'If we are on a 64-bit OS...
If strOS64 = "1" Then
'If instructed to search the 32-bit registry...
If strRegSearchType = "A" Then
'MsgBox "searching the 64-bit registry for " & strRegKeyPath & "\" & strRegValName & "..."
objCtx.Add "__ProviderArchitecture", 64
'If instructed to search the 64-bit registry...
Elseif strRegSearchType = "B" Then
'MsgBox "searching the 32-bit registry for " & strRegKeyPath & "\" & strRegValName & "..."
objCtx.Add "__ProviderArchitecture", 32
End If
Set objLocator = CreateObject("Wbemscripting.SWbemLocator")
Set objServices = objLocator.ConnectServer("","root\default","","",,,,objCtx)
Set objReg = objServices.Get("StdRegProv")
'Else if we are on a 32-bit OS...
Else
'MsgBox "searching the registry for " & strRegKeyPath & "\" & strRegValName & "..."
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
End If
Select Case strRegValType
Case "A"
objReg.GetBinaryValue strRegRoot, strRegKeyPath, strRegValName, strValue
'MsgBox "Binary strValue = " & strValue
Case "B"
objReg.GetStringValue strRegRoot, strRegKeyPath, strRegValName, strValue
'MsgBox "String strValue = " & strValue
Case "C"
objReg.GetExpandedStringValue strRegRoot, strRegKeyPath, strRegValName, strValue
'MsgBox "Expanded String strValue = " & strValue
Case "D"
objReg.GetMultiStringValue strRegRoot, strRegKeyPath, strRegValName, strValue
'MsgBox "Multi-String strValue = " & strValue
Case "E"
objReg.GetDWORDValue strRegRoot, strRegKeyPath, strRegValName, strValue
'MsgBox "DWORD strValue = " & strValue
Case "F"
objReg.GetQWORDValue strRegRoot, strRegKeyPath, strRegValName, strValue
'MsgBox "QWORD strValue = " & strValue
Case Else strValue = ""
'MsgBox "null strValue = " & strValue
End Select
If Len(strValue) > 0 Then
SetVariable "REGKEY_VALUE", strValue
Else
SetVariable "REGKEY_VALUE", strDefaultVal
End If
Works great!
Works great! Thanks so much for your sharing your work! I've been looking for something like this for a long time.
I made only two minor tweaks:
It might be good to post the two actual files somewere. I've been working with Wise long enough that I knew how to import what you posted. But it might be more difficult for some others.
Cheers!
Rob
Works great! - Also, here's a script to enumerate registry keys
I'd be glad to post the files. Is there a way to include attachments in messages to this forum? If not, anyone know of a public repository for Wise scripts?
Meanwhile, here is another UDA. This one enumerates the subkeys of a given registry key.
Here is the main script:
item: Remark
Text=This script enumerates the subkeys of a given registry key
end
item: Remark
Text=It can enumerate keys on 32-bit or 64-bit Windows.
end
item: Remark
end
item: Remark
Text=Determine if OS is 64 bit
end
item: Get System Information
Variable=X64
Flags=00011000
end
item: Remark
end
item: Set Variable
Variable=%RETURNVAL%
end
item: Set Variable
Variable=REGROOT
Value=%REGROOT%
end
item: Set Variable
Variable=_REGROOT
Value=%_REGROOT%
end
item: Set Variable
Variable=REGKEY
Value=%REGKEY%
end
item: Set Variable
Variable=DEFAULTVAL
Value=%DEFAULTVAL%
end
item: Set Variable
Variable=32_OR_64
Value=%32_OR_64%
end
item: Set Variable
Variable=_32_OR_64
Value=%_32_OR_64%
end
item: Set Variable
Variable=SUBKEYS
end
item: Remark
end
item: Execute VBScript
Pathname=C:\Wise Scripts\User Defined Actions\UDA Enumerate Registry Key.vbs
end
item: Set Variable
Variable=%RETURNVAL%
Value=%SUBKEYS%
end
Here is the Exit script and dialog...
item: Custom Dialog Set
Name=Enumerate Regkey
item: Dialog
Title=Enumerate Registry Key
Width=195
Height=241
Font Name=Helv
Font Size=8
item: Combobox
Rectangle=63 12 184 36
Variable=RETURNVAL
Enabled Color=00000000000000001111111111111111
Create Flags=01010000001000010000001101000010
Text=%_VAR_LIST_%
Text=
end
item: Editbox
Control Name=defaultval
Rectangle=63 29 184 43
Variable=DEFAULTVAL
Help Context=16711680
Enabled Color=00000000000000001111111111111111
Create Flags=01010000100000010000000010000000
Text=%DEFAULTVAL%
end
item: Editbox
Control Name=regkey
Rectangle=63 46 184 60
Variable=REGKEY
Help Context=16711680
Enabled Color=00000000000000001111111111111111
Create Flags=01010000100000010000000010000000
Text=%REGKEY%
end
item: Radio Button
Control Name=regroot
Rectangle=13 79 103 142
Variable=REGROOT
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000010000000000001001
Text=HKEY_CLASSES_ROOT
Text=HKEY_CURRENT_USER
Text=HKEY_LOCAL_MACHINE
Text=HKEY_USERS
Text=HKEY_CURRENT_CONFIG
Text=
end
item: Radio Button
Rectangle=13 165 109 189
Variable=32_OR_64
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000010000000000001001
Text=The key is a 64-bit registry key
Text=The key is a 32-bit registry key
Text=
end
item: Push Button
Rectangle=111 205 146 220
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000010000000000000001
Text=OK
end
item: Push Button
Rectangle=150 205 185 220
Action=3
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000010000000000000000
Text=Cancel
end
item: Static
Rectangle=13 69 30 80
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Root
end
item: Static
Control Name=Root
Rectangle=7 73 108 146
Action=3
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000001000
end
item: Static
Rectangle=7 154 115 191
Action=3
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000001000
end
item: Static
Rectangle=13 151 75 161
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Behavior on 64-bit OS
end
item: Static
Rectangle=12 30 53 43
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Default Value:
end
item: Static
Rectangle=12 47 53 61
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Registry Key:
end
item: Static
Rectangle=12 13 59 26
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Variable Name:
end
item: If/While Statement
Variable=DLG_EVENT_TYPE
Value=VERIFY
end
item: If/While Statement
Variable=REGROOT
Value=A
end
item: Set Variable
Variable=REGROOT
Value=HKEY_CLASSES_ROOT
end
item: ElseIf Statement
Variable=REGROOT
Value=B
end
item: Set Variable
Variable=REGROOT
Value=HKEY_CURRENT_USER
end
item: ElseIf Statement
Variable=REGROOT
Value=C
end
item: Set Variable
Variable=REGROOT
Value=HKEY_LOCAL_MACHINE
end
item: ElseIf Statement
Variable=REGROOT
Value=D
end
item: Set Variable
Variable=REGROOT
Value=HKEY_USERS
end
item: ElseIf Statement
Variable=REGROOT
Value=E
end
item: Set Variable
Variable=REGROOT
Value=HKEY_CURRENT_CONFIG
end
item: End Block
end
item: If/While Statement
Variable=32_OR_64
Value=A
end
item: Set Variable
Variable=BIT
Value=64-bit
end
item: ElseIf Statement
Variable=32_OR_64
Value=B
end
item: Set Variable
Variable=BIT
Value=32-bit
end
item: End Block
end
item: End Block
end
end
end
Finally, here is the VBScript:
' This script enumerates the subkeys of the specified registry key,
' returning the subkeys in a comma delimited list in the variable SUBKEYS.
' On 64-bit Windows it can enumerate keys in either the 32-bit or the 64-bit registry.
On Error Resume Next ' necessary to avoid the "Name redefined" VBScript error message
' when this script is executed more than once in the same Wise script
Dim strOS64, str32_or_64, strRegRoot, hexRegRoot, strComputer, strKeyPath, SubKey, strSubKeys, arrSubKeys
strComputer = "."
strRegRoot = GetVariable("_REGROOT")
strOS64 = GetVariable("X64")
strKeyPath = GetVariable("REGKEY")
str32_or_64 = GetVariable("32_OR_64")
strSubKeys = ""
Select Case strRegRoot
Case "HKEY_CLASSES_ROOT" hexRegRoot = &H80000000
Case "HKEY_CURRENT_USER" hexRegRoot = &H80000001
Case "HKEY_LOCAL_MACHINE" hexRegRoot = &H80000002
Case "HKEY_USERS" hexRegRoot = &H80000003
Case "HKEY_CURRENT_CONFIG" hexRegRoot = &H80000005
Case Else hexRegRoot = "not set"
End Select
'If we are on a 64-bit OS...
If strOS64 = "1" Then
If str32_or_64 = "A" Then
'---------------------------------------------------------------------------------------------------
' Enumerate subkeys of the specified key in the 64-bit registry
'---------------------------------------------------------------------------------------------------
' In order to access the 64-bit registry, we had to replace the commented out "objReg=." line below.
' This is because our VBScript executes as a 32-bit process since it is under the control of the
' Wise Script which itself Is a 32-bit process. 32 bit apps running On 64-bit Windows can only
' access the 32-bit (WOW6432Node) portion of the registry. The workaround is to use WMI And the
' __ProviderArchitecture parameter to explicitly request access to the portion of the registry we
' need to read. Ref. Microsoft MSDN article titled "Requesting WMI Data on a 64-bit Platform"
' "http://msdn.microsoftcom/en-us/library/aa393067(VS85)aspx
' Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
Set objCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
Set objLocator = CreateObject("Wbemscripting.SWbemLocator")
' Set the registry provider to the 64-bit registry provider
objCtx.Add "__ProviderArchitecture", 64
Set objServices = objLocator.ConnectServer("","root\default","","",,,,objCtx)
Set objReg = objServices.Get("StdRegProv")
'MsgBox "Enumerating the subkeys of " & strKeyPath & " in the 64-bit registry..."
objReg.EnumKey hexRegRoot, strKeyPath, arrSubKeys
Else
'------------------------------------------------------------------------------------------
' Enumerate subkeys of the specified key in the 32-bit registry
'------------------------------------------------------------------------------------------
' Set the registry provider to the 32-bit registry provider
objCtx.Add "__ProviderArchitecture", 32
Set objServices = objLocator.ConnectServer("","root\default","","",,,,objCtx)
Set objReg = objServices.Get("StdRegProv")
' Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
'MsgBox "Enumerating the subkeys of " & strKeyPath & " in the 32-bit registry..."
objReg.EnumKey hexRegRoot, strKeyPath, arrSubKeys
End If
Else
'------------------------------------------------------------------------------------------
' Enumerate subkeys of the specified key
'------------------------------------------------------------------------------------------
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
'MsgBox "Enumerating the subkeys of " & strKeyPath & "..."
objReg.EnumKey hexRegRoot, strKeyPath, arrSubKeys
End If
strSubKeys = ""
If IsArray(arrSubKeys) Then
For Each Subkey In arrSubKeys
If strSubKeys = "" Then
strSubKeys = SubKey
Else
strSubKeys = strSubKeys & "," & SubKey
End If
Next
SetVariable "SUBKEYS", strSubKeys
End If
Rob - why not post your script here also
Rob,
In the spirit of sharing, why not post your script here also, with the changes you made. No doubt others can benefit in the future.
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
Another alterniative would be
Another alterniative would be to create a blog post that contained the scripts as attached files and referred back to this thread.
Cheryl
Endpoint Management,
Endpoint Virtualization
Community Manager
www.twitter.com/EMnV_symc
Need Altiris help? IRC chat #Altiris
'Edit Registry Key' script action (64-bit)
Here is a 64-bit version of the 'Edit Registry Key' script action.
Main script:
item: Remark
Text=File: UDA Edit Registry Key Value.wse
end
item: Remark
Text=Replacement for the Get Registry Key Value script action
end
item: Remark
Text=Written to work around the limitation of Wise's inability to access the 64-bit portion of the registry.
end
item: Remark
end
item: Remark
Text=Determine if OS is 64 bit
end
item: Get System Information
Variable=X64
Flags=00011000
end
item: Remark
end
item: Set Variable
Variable=REGROOT
Value=%REGROOT%
end
item: Set Variable
Variable=_REGROOT
Value=%_REGROOT%
end
item: Set Variable
Variable=REGKEY
Value=%REGKEY%
end
item: Set Variable
Variable=REGVALNAME
Value=%REGVALNAME%
end
item: Set Variable
Variable=VALUE
Value=%VALUE%
end
item: Set Variable
Variable=REGVALTYPE
Value=%REGVALTYPE%
end
item: Set Variable
Variable=_REGVALTYPE
Value=%_REGVALTYPE%
end
item: Set Variable
Variable=OPERATION
Value=%OPERATION%
end
item: Remark
end
item: Execute VBScript
Pathname=C:\Wise Scripts\User Defined Actions\UDA Edit Registry Key.vbs
end
Exit script and dialog:
item: Custom Dialog Set
Name=Edit Registry Key
item: Dialog
Title=Edit Registry Key Value
Width=219
Height=379
Font Name=Helv
Font Size=8
item: Editbox
Control Name=regkey
Rectangle=70 64 191 78
Variable=REGKEY
Help Context=16711680
Enabled Color=00000000000000001111111111111111
Create Flags=01010000100000010000000010000000
Text=%REGKEY%
end
item: Editbox
Control Name=regvalname
Rectangle=70 81 191 95
Variable=REGVALNAME
Help Context=16711680
Enabled Color=00000000000000001111111111111111
Create Flags=01010000100000010000000010000000
Text=%REGVALNAME%
end
item: Radio Button
Control Name=regroot
Rectangle=19 112 109 175
Variable=REGROOT
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000010000000000001001
Text=HKEY_CLASSES_ROOT
Text=HKEY_CURRENT_USER
Text=HKEY_LOCAL_MACHINE
Text=HKEY_USERS
Text=HKEY_CURRENT_CONFIG
Text=
end
item: Radio Button
Control Name=regsearchtype
Rectangle=125 114 197 138
Variable=REGSEARCHTYPE
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000010000000000001001
Text=Edit the 64-bit registry
Text=Edit the 32-bit registry
Text=
end
item: Editbox
Control Name=regkey
Rectangle=44 209 201 236
Variable=VALUE
Help Context=16711680
Enabled Color=00000000000000001111111111111111
Create Flags=01010000101000010000000010000100
Text=%VALUE%
end
item: Radio Button
Rectangle=18 253 118 318
Variable=OPERATION
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000010000000000001001
Text=Create/update key and value
Text=Create empty key
Text=Remove key and all subkeys
Text=Remove key value only
Text=Preserve existing key and value
Text=
end
item: Radio Button
Control Name=regvaltype
Rectangle=132 255 193 318
Variable=REGVALTYPE
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000010000000000001001
Text=Binary
Text=String
Text=Expanded String
Text=Multi String
Text=DWORD
Text=QWORD
Text=
end
item: Push Button
Rectangle=135 341 170 356
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000010000000000000001
Text=OK
end
item: Push Button
Rectangle=174 341 209 356
Action=3
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000010000000000000000
Text=Cancel
end
item: Static
Rectangle=5 8 209 44
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Unlike the built-in 'Edit Registry' script action, this user defined action can access both the 32-bit and 64-bit portions of the Windows registry. However, this version can only edit a single key, whereas the built-in action can edit multiple keys in the same dialog.
end
item: Static
Rectangle=19 81 60 95
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Value Name:
end
item: Static
Rectangle=19 65 60 79
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Registry Key:
end
item: Static
Control Name=Root
Rectangle=13 106 114 179
Action=3
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000001000
end
item: Static
Rectangle=19 102 36 113
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Root
end
item: Static
Control Name=Root
Rectangle=125 249 201 321
Action=3
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000001000
end
item: Static
Rectangle=132 245 165 255
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Type
end
item: Static
Rectangle=119 106 202 179
Action=3
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000001000
end
item: Static
Rectangle=125 103 187 113
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Behavior on 64-bit OS
end
item: Static
Rectangle=5 53 209 186
Action=1
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000111
Text=Key to edit
end
item: Static
Rectangle=5 198 209 330
Action=1
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000111
Text=Data Settings
end
item: Static
Rectangle=13 249 119 321
Action=3
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000001000
end
item: Static
Rectangle=19 244 49 254
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Operation
end
item: Static
Rectangle=19 210 41 224
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Value:
end
item: If/While Statement
Variable=DLG_EVENT_TYPE
Value=VERIFY
end
item: If/While Statement
Variable=REGROOT
Value=A
end
item: Set Variable
Variable=_REGROOT
Value=HKEY_CLASSES_ROOT
end
item: ElseIf Statement
Variable=REGROOT
Value=B
end
item: Set Variable
Variable=_REGROOT
Value=HKEY_CURRENT_USER
end
item: ElseIf Statement
Variable=REGROOT
Value=C
end
item: Set Variable
Variable=_REGROOT
Value=HKEY_LOCAL_MACHINE
end
item: ElseIf Statement
Variable=REGROOT
Value=D
end
item: Set Variable
Variable=_REGROOT
Value=HKEY_USERS
end
item: ElseIf Statement
Variable=REGROOT
Value=E
end
item: Set Variable
Variable=_REGROOT
Value=HKEY_CURRENT_CONFIG
end
item: End Block
end
item: If/While Statement
Variable=REGVALTYPE
Value=A
end
item: Set Variable
Variable=_REGVALTYPE
Value=REG_BINARY
end
item: ElseIf Statement
Variable=REGVALTYPE
Value=B
end
item: Set Variable
Variable=_REGVALTYPE
Value=REG_SZ
end
item: ElseIf Statement
Variable=REGVALTYPE
Value=C
end
item: Set Variable
Variable=_REGVALTYPE
Value=REG_EXPAND_SZ
end
item: ElseIf Statement
Variable=REGVALTYPE
Value=D
end
item: Set Variable
Variable=_REGVALTYPE
Value=REG_MULTI_SZ
end
item: ElseIf Statement
Variable=REGVALTYPE
Value=E
end
item: Set Variable
Variable=_REGVALTYPE
Value=REG_DWORD
end
item: ElseIf Statement
Variable=REGVALTYPE
Value=F
end
item: Set Variable
Variable=_REGVALTYPE
Value=REG_QWORD
end
item: End Block
end
item: If/While Statement
Variable=REGSEARCHTYPE
Value=A
end
item: Set Variable
Variable=BIT
Value=64-bit
end
item: ElseIf Statement
Variable=REGSEARCHTYPE
Value=B
end
item: Set Variable
Variable=BIT
Value=32-bit
end
item: End Block
end
item: End Block
end
end
end
Associated VBScript:
Dim strComputer, strOS64, strRegRoot, hexRegRoot, strRegKeyPath, strRegValName, strRegSearchType
Dim strValue, strType, strOperation, strReturnVal, blnSubKeyExists, statusCode, strSubKey
strComputer = "."
strOS64 = GetVariable("X64")
strRegRoot = GetVariable("_REGROOT")
strRegKeyPath = GetVariable("REGKEY")
strRegValName = GetVariable("REGVALNAME")
strRegSearchType = GetVariable("REGSEARCHTYPE")
'strOS64 = "0"
'strRegRoot = "HKEY_LOCAL_MACHINE"
'strRegKeyPath = "Software\Abilene\Games"
'strRegValName = "GameName"
'strRegSearchType = "A"
Select Case strRegRoot
Case "HKEY_CLASSES_ROOT" hexRegRoot = &H80000000
Case "HKEY_CURRENT_USER" hexRegRoot = &H80000001
Case "HKEY_LOCAL_MACHINE" hexRegRoot = &H80000002
Case "HKEY_USERS" hexRegRoot = &H80000003
Case "HKEY_CURRENT_CONFIG" hexRegRoot = &H80000005
Case Else hexRegRoot = "not set"
End Select
strValue = GetVariable("VALUE")
strType = GetVariable("_REGVALTYPE")
strOperation = GetVariable("OPERATION")
'strValue = "Serendipity"
'strType = "REG_SZ"
'strOperation = "A"
Set objCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
'If we are on a 64-bit OS...
If strOS64 = "1" Then
'If instructed to search the 32-bit registry...
If strRegSearchType = "A" Then
' MsgBox "Editing the 64-bit registry key " & strRegKeyPath & "\" & strRegValName & "..."
objCtx.Add "__ProviderArchitecture", 64
'If instructed to search the 64-bit registry...
Elseif strRegSearchType = "B" Then
' MsgBox "Editing the 32-bit registry key " & strRegKeyPath & "\" & strRegValName & "..."
objCtx.Add "__ProviderArchitecture", 32
End If
Set objLocator = CreateObject("Wbemscripting.SWbemLocator")
Set objServices = objLocator.ConnectServer("","root\default","","",,,,objCtx)
Set objReg = objServices.Get("StdRegProv")
'Else if we are on a 32-bit OS...
Else
' MsgBox "Editing the registry key " & strRegKeyPath & "\" & strRegValName & "..."
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
End If
Select Case strOperation
Case "A" ' Create/update key And value
' First create the key if it does not already exist
If Not keyExists(hexRegRoot, strRegKeyPath) Then
objReg.CreateKey hexRegRoot, strRegKeyPath
' MsgBox "New registry key " & strRegKeyPath & " created."
End If
' Then create or update the value
Select Case strType
Case "REG_BINARY"
statusCode = objReg.SetBinaryValue(hexRegRoot, strRegKeyPath, strRegValName, strValue)
Case "REG_SZ"
statusCode = objReg.SetStringValue(hexRegRoot, strRegKeyPath, strRegValName, strValue)
Case "REG_EXPAND_SZ"
statusCode = objReg.SetExpandedStringValue(hexRegRoot, strRegKeyPath, strRegValName, strValue)
Case "REG_MULTI_SZ"
statusCode = objReg.SetMultiStringValue(hexRegRoot, strRegKeyPath, strRegValName, strValue)
Case "REG_DWORD"
statusCode = objReg.SetDWORDValue(hexRegRoot, strRegKeyPath, strRegValName, strValue)
Case "REG_QWORD"
statusCode = objReg.SetQWORDValue(hexRegRoot, strRegKeyPath, strRegValName, strValue)
' Case Else
' statusCode = "-9999992"
End Select
' If statusCode <> 0 Then
' MsgBox "Unable to set value of " & strRegKeyPath & "\" & strRegValName & " to " & strValue & "." & vbCrlf & "statusCode = " & statusCode
' Else
' MsgBox "New registry value " & strRegKeyPath & "\" & strRegValName & " created."
' End If
' MsgBox "Registry key " & strRegKeyPath & "\" & strRegValName & " created/updated."
Case "B" ' Create empty key
If keyExists(hexRegRoot, strRegKeyPath) Then
' Key already exists so leave it alone
' MsgBox "Registry key " & strRegKeyPath & " already exists"
Else
' Key does not exist so create it
objReg.CreateKey hexRegRoot, strRegKeyPath
' MsgBox "New empty registry key " & strRegKeyPath & " created."
End If
Case "C" ' Remove key and all subkeys
statusCode = objReg.DeleteKey(hexRegRoot, strRegKeyPath)
' If statusCode = 0 Then ' Key was successfully deleted
' MsgBox "Registry key " & strRegKeyPath & " was successfully deleted."
' Else
' MsgBox "Registry key " & strRegKeyPath & " does not exist."
' End If
Case "D" ' Remove key value only
statusCode = objReg.DeleteValue(hexRegRoot, strRegKeyPath, strRegValName)
' If statusCode = 0 Then ' Value was successfully deleted
' MsgBox "Registry key value " & strRegKeyPath & "\" & strRegValName & " was successfully deleted."
' Else
' MsgBox "Registry key value " & strRegKeyPath & "\" & strRegValName & " does not exist."
' End If
Case "E" ' Preserve existing key and value (ie. Add key and value if they do not already exist,
' but leave existing value in place if it already exists.)
' MsgBox "strType = " & strType & vbCrLf & "strValue = " & strValue
Select Case strType
Case "REG_BINARY"
statusCode = objReg.GetBinaryValue(hexRegRoot, strRegKeyPath, strRegValName, strVal)
Case "REG_SZ"
statusCode = objReg.GetStringValue(hexRegRoot, strRegKeyPath, strRegValName, strVal)
Case "REG_EXPAND_SZ"
statusCode = objReg.GetExpandedStringValue(hexRegRoot, strRegKeyPath, strRegValName, strVal)
Case "REG_MULTI_SZ"
statusCode = objReg.GetMultiStringValue(hexRegRoot, strRegKeyPath, strRegValName, strVal)
Case "REG_DWORD"
statusCode = objReg.GetDWORDValue(hexRegRoot, strRegKeyPath, strRegValName, strVal)
Case "REG_QWORD"
statusCode = objReg.GetQWORDValue(hexRegRoot, strRegKeyPath, strRegValName, strVal)
Case Else
statusCode = "-1"
End Select
If statusCode <> 0 Then ' Registry value does not exist so create it
' MsgBox "Registry value " & strRegValName & " does not exist."
' Check to see if the key (not the value) exists, and if not, it will also need to be created
If Not keyExists(hexRegRoot, strRegKeyPath) Then
objReg.CreateKey hexRegRoot, strRegKeyPath
' MsgBox "New registry key " & strRegKeyPath & " created."
End If
' Then set the value
Select Case strType
Case "REG_BINARY"
statuscode = objReg.SetBinaryValue(hexRegRoot, strRegKeyPath, strRegValName, strValue)
Case "REG_SZ"
statusCode = objReg.SetStringValue(hexRegRoot, strRegKeyPath, strRegValName, strValue)
Case "REG_EXPAND_SZ"
statusCode = objReg.SetExpandedStringValue(hexRegRoot, strRegKeyPath, strRegValName, strValue)
Case "REG_MULTI_SZ"
statusCode = objReg.SetMultiStringValue(hexRegRoot, strRegKeyPath, strRegValName, strValue)
Case "REG_DWORD"
statusCode = objReg.SetDWORDValue(hexRegRoot, strRegKeyPath, strRegValName, strValue)
Case "REG_QWORD"
statusCode = objReg.SetQWORDValue(hexRegRoot, strRegKeyPath, strRegValName, strValue)
Case Else
statusCode = "-1"
End Select
' If statuscode <> 0 Then
' MsgBox "Unable to set value of " & strRegKeyPath & "\" & strRegValName & " to " & strValue & "."
' Else
' MsgBox "New registry value " & strRegKeyPath & "\" & strRegValName & " created."
' End If
' Else
' MsgBox "Registry key and value " & strRegKeyPath & "\" & strRegValName & " already exists."
End If
End Select
64-bit registry script actions posted here
I have posted the zipped script files to the Symantec Connect Downloads page at http://www.symantec.com/connect/downloads/wise-installatin-builder-7-64-bit-registry-script-actions. Thanks to Rob Weir for the tip.
It supports 64 bit
I tried with one 64 bit and it succeeded for 64bit
What about the other 64 bit?
Did it work with the other 64 bit also? May be useful if you can specify which 64 bit you tested with, as there are now many to choose from.
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
64-bit registry script actions posted here - Updated (bug fix)
I have updated the zip file posted at http://www.symantec.com/connect/downloads/wise-installatin-builder-7-64-bit-registry-script-actions. There was a bug in the 'UDA Edit Registry Key Value' user defined action. I fixed the bug and re-tested. Please note that these UDA's have only been tested on WINXP32 and WINXP64, not on Vista or Windows 7. They are not warranted in any way.
64 bit registry help
great tools thanks for doing the work.
Hi, You have some crazy
Hi,
You have some crazy absolute paths in your Wise scripts and I had to fix them but it ended up working with WiseScript Package Editor (Installation Studio 7.0). How about making the path %_WISEACTIONS_% and then someone will just need to set that depending on where the actions folder is? On my system it is c:\Program Files\Altiris\Wise\WiseScript Package Editor\Actions.
I also had to fix the UDA Enumerate Registry Keys.wse by adding underscores before REGROOT for the dialog (compare it to the Get Registry Key script).
This stuff worked for me under Vista Ultimate 64-bit and XP SP3 32-bit.
Anyway if there's anything I do to help like send you my fixes I am more than willing to help since this has helped me immensly.
Thanks,
Albert
Upload your scripts too
You could upload your scripts with a reference to the original scripts that you modified. That way your changes will be available to a larger audience.
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
Would you like to reply?
Login or Register to post your comment.