Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1667
  • Last Modified:

Remotely modify registry key for DNS entries on multiple computers

Looking for a way to edit registry key: [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters\NameServer on multiple servers.  
0
cgooden01
Asked:
cgooden01
2 Solutions
 
cgooden01Author Commented:
Correction..Not multiple Servers..Multiple workstations. I dont have access to GPO creation/modification nor the DNS/DHCP Server to make changes as well.  Would like to just attach myself to a server in our network and make this change.  
0
 
gavsmithCommented:
You can do this in Registry Editor, just run regedit, click on file and goto 'Connect Network Registry...' then type in your remote workstation name.

Once it's connected if you try to import registry settings using 'File->Import...' it will ask you which workstation you would like to apply the settings too. You can attach to multiple workstations in one console and apply the import to multiple manchines at once.

Hope that helps
Gav
0
 
OrenRozenCommented:
another option is to use the REG command-line utility, if you need to work on remote machine from CLI or batch scripts
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Here2HelpCommented:
Hey.


Yeah the REG command should do the trick.

Stick this code into your batch. Change 'Machinename' & 'EnterNameServerName' to suit.

reg add \\Machinename\hklm\system\ControlSet001\Services\Tcpip\Parameters\NameServer /v NameServer /t REG_SZ /d EnterNameServerName

Remember the Remote Registry service may need to be started on the remote machine for you to run this.

Alternatively...

You could try using PsExec to remotely change these reg values.

psexec \\MachineName -i -d -s c:\windows\regedit.exe

There you would be able to interactively change reg values via regedit.

cheers



0
 
RobSampsonCommented:
Hi, I've taken Here2Help's Reg Add command, and wrapped it in a VBScript to read the computer names from a text file.

Regards,

Rob.
strFile = "computers.txt"
strServerName = "YourNameServer"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Const intForReading = 1
Set objShell = CreateObject("WScript.Shell")
Set objFile = objFSO.OpenTextFile(strFile, intForReading, False)
While Not objFile.AtEndOfStream
	strComputer = objFile.ReadLine
	strCommand = "cmd /c reg add \\" & strComputer & "\hklm\system\ControlSet001\Services\Tcpip\Parameters\NameServer /v NameServer /t REG_SZ /d " & strServerName
	objShell.Run strCommand, 0, True
Wend
objFile.Close
MsgBox "Done"

Open in new window

0
 
cgooden01Author Commented:
Rob,

Im trying your solution now and ill see how this works. Will let you know shortly.  Thanks...
0
 
RobSampsonCommented:
Hi, how did you go with the testing?

Regards,

Rob
0
 
cgooden01Author Commented:
Tried different attempts to have this automated. I modify the script and it showed or may i say indicated that it was completed, but when I check each system i test it with, which was only 10 computers, no changes were mad, so i had to manually remote into each registry and change it that way.  Took some time, but i got it accomplished. Thanks for your inputs and assistance regardless..
0
 
RobSampsonCommented:
Fair enough.  If you wanted to troubleshoot the script anyway, change this bit:
	strCommand = "cmd /c reg add \\" & strComputer & "\hklm\system\ControlSet001\Services\Tcpip\Parameters\NameServer /v NameServer /t REG_SZ /d " & strServerName
	objShell.Run strCommand, 0, True

Open in new window


to this:
	strCommand = "cmd /k reg add \\" & strComputer & "\hklm\system\ControlSet001\Services\Tcpip\Parameters\NameServer /v NameServer /t REG_SZ /d " & strServerName
	objShell.Run strCommand, 1, True

Open in new window


and see what the outcome of the reg add command is.

Regards,

Rob.
0
 
cgooden01Author Commented:
Pointed me in a good direction but didnt completely resolve my issue.
0

Featured Post

Evaluating UTMs? Here's what you need to know!

Evaluating a UTM appliance and vendor can prove to be an overwhelming exercise.  How can you make sure that you're getting the security that your organization needs without breaking the bank? Check out our UTM Buyer's Guide for more information on what you should be looking for!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now