Hello All,

I want to change the Source file Server path location in the reg path HKEY_CLASSES_ROOT\Installer\Products\Product GUID\SourceList\Net\1 of every client machines, as we have removed the existing Application server with a new one...We were able to change the old server path to new server path using the "replace" function in vbscript. Set objWS = CreateObject("WScript.Shell")

strKeyValue = objWS.RegRead("HKEY_CLASSES_ROOT\Installer\Products\A7C4EB2D0BDDF2A43BDD35A498E12655\SourceList\Net\1")

newstrKeyValue = Replace(strKeyValue,"\\INADCSRV11" ,"\\INADCSRV12")

newstrKeyValue2 = Replace (newstrKeyValue ,"SMSPKGC$" ,"SMSPKGP$")

Const HKEY_CLASSES_ROOT = &H80000000
strComputer = "."

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")

strKeyPath = "Installer\Products\A7C4EB2D0BDDF2A43BDD35A498E12655\SourceList\Net\"
strValueName = "1"
strValue = newstrKeyValue2

oReg.SetExpandedStringValue HKEY_CLASSES_ROOT,strKeyPath,strValueName,strValue
but we are stuck in reading the reg values.... Product GUID is a variable.First we have to read till that path and then after reading one GUID, again we have to read the complete path HKEY_CLASSES_ROOT\Installer\Products\<Product GUID>\SourceList\Net\1 and then change the server name Please let me know anyone have encountered any situation like this.
0 Comments   [ - ] Hide Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity


Firstly, I hope now you can see why people use DNS aliases for things like deployment servers?

Secondly, which part are you having problems with? How to loop through the keys or mangling the GUID to its "compressed" form? Either way, solutions have been posted here many times.

For reading the keys, their values and data, check out the registry class which is part of the JSWare class pack (actually, I think I've posted the entire script here before). It has functions EnumKeys and EnumValuesAndData (or similar names).

For mangling and unmangling GUIDs, searching my posts for the word "munge" should turn up 2 functions for that.
Answered 11/18/2011 by: VBScab
Red Belt

Please log in to comment
Thank you VBScab for the inputs...

I wrote the script..

On error resume next
Const HKEY_CLASS_ROOT = &H80000000

strComputer = "."
strKeyPath = "Installer\Products"

Set objShell = CreateObject("WScript.Shell")
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")

oReg.EnumKey HKEY_CLASS_ROOT, strKeyPath, arrSubkeys

If IsArray(arrSubkeys) Then
For Each strSubkey In arrSubkeys

strkeyvalue = objShell.regread ("HKEY_CLASSES_ROOT\Installer\Products\" & strSubkey & "\SourceList\Net\1")

strKeySuffix = Left(strkeyvalue, 12)

if strKeySuffix = "\\DCASRV11" then

newstrKeyValue = Replace (strkeyvalue, "\\DCASRV11", "\\DCASRV12")

newstrKeyValue2 = Replace (newstrKeyValue ,"SMSPKGC$" ,"SMSPKGP$")

strKeyPath = "Installer\Products\" & strSubkey & "\SourceList\Net\"
strValueName = "1"
strValue = newstrKeyValue2

oReg.SetExpandedStringValue HKEY_CLASSES_ROOT,strKeyPath,strValueName,strValue

End if
End If

But the probelm is it is not overwriting the existing value. If I run the vbs after removing the array part(tried with one GUID) it is overwriting the Value..

I think the issue is with the "oReg.SetExpandedStringValue HKEY_CLASSES_ROOT,strKeyPath,strValueName,strValue"

Any thoughts on this..
Answered 11/21/2011 by: anphi
Orange Belt

  • Hello,
    I need to do the same thing and wanted to know if you where able to get a working script?
Please log in to comment
Install a script debugger. At the very least, try the Microsoft Script Debugger but better, if you install Visual Studio Express Edition, use that. You can then 'Debug.Print [variable_name]' or 'Debug.Print err.number' and so on.
Answered 11/21/2011 by: VBScab
Red Belt

Please log in to comment
Did you try this ? [:)]

Dim objInstaller
Set objInstaller = CreateObject("WindowsInstaller.Installer")
objInstaller.AddSource "{YOURAPPLICATIONGUID}", "", "\\NEWSERVER\Path"

Answered 11/23/2011 by: skalpa
Senior Yellow Belt

Please log in to comment