Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question about registry writes script

Status
Not open for further replies.

ITAAGuyOR

MIS
May 31, 2005
29
US
I am not going to beat around the bush. I am not experienced enough to figure this out so I am asking the experts here for some help. I am using the following script to write some strings into the registry of remote PC's but I need to know if there is a relatively easy way to alter the script to include multiple machine names or even a call to an external text file that has a list of machine names? It is too tedious to run this for each machine and I don't want to run it as a logon script. Thanks if you can help. Here is the code I am using:


Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."

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

strKeyPath = "System\CurrentControlSet\Services\LanmanServer\Parameters"
strValueName = "Hidden2"
strValue = "1"
oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue

strValueName = "Hidden2"
dwValue = 1
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue

 
A starting point:
For Each strComputer In Array("PC01", "SomePC", ..., "Another")
Set oReg = ...
...
Next

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
That is a good start....thank you. I would still be curious how to use an external file with this, but your help is much appreciated.
 
Have a look at FileSystemObject (aka fso).

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top