I would like to change the below value on a remote machine, please could someone advise how I would do this in VBscript?

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters\srvcomment: "XXXXXX"
0 Comments   [ + ] Show Comments

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.

Answers

0
Yo Yo Naffcat!

To modify the registry remotely you can use the StdRegProv provider in WMI: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/stdregprov.asp

Here is an example to modify the registry on a remote computer from the MSDN website:

HKEY_LOCAL_MACHINE = &H80000002
strRemoteComputer = "atl-ws-001"

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

strPath = "SOFTWARE\MyKey\MySubKey"

Return = objRegistry.CreateKey(HKEY_LOCAL_MACHINE, strPath)

If Return <> 0 Then
WScript.Echo "The operation failed." & Err.Number
WScript.Quit
Else
wScript.Echo "New registry subkey created" & VBCRLF & "HKLM\SOFTWARE\MYKey\"

End If


PS: Obviously you will need to have the neccessary permissions to the remote computer to make these changes...
Answered 03/03/2005 by: brenthunter2005
Fifth Degree Brown Belt

Please log in to comment
0
Thanks Brent!

The given example creates a key what about just changing a value, i.e. the XXXXX listed in my previous? I looked on the site but couldn't find what I was after.

Can you help?
Answered 03/03/2005 by: Naffcat
Senior Purple Belt

Please log in to comment
0
Answered 03/03/2005 by: brenthunter2005
Fifth Degree Brown Belt

Please log in to comment
0
Thanks got it working now.
Answered 03/17/2005 by: Naffcat
Senior Purple Belt

Please log in to comment
Answer this question or Comment on this question for clarity