compiling a script
- From: Lesedi Ntoana
- Date: Tue, 18 Dec 2007 04:57:46 -0800
How do I run the following script if I want to rename my computers in the domain? If you have a better solution please let me know. This is my first time doing a script and your help will be very appreciated.
strcomputer="xxxxxxxxxxxxxxxx"
username="" ' local admin account on computer to be renamed
password=""
On Error Resume Next
Const HKEY_LOCAL_MACHINE = &H80000002
Set objLocator = CreateObject("WbemScripting.SWbemLocator")
Set objService = objLocator.ConnectServer(strComputer,
"Root\DEFAULT,username,password)
Set objRegistry = objService.Get("StdRegProv")
strKeyPath = "System\CurrentControlSet\Control\ComputerName\Comp uterName"
strValueName = "ComputerName"
objRegistry.SetStringValue
HKEY_LOCAL_MACHINE,strKeyPath,strValueName,newname .value
strValueName = "ActiveComputerName"
objRegistry.SetStringValue
HKEY_LOCAL_MACHINE,strKeyPath,strValueName,newname .value
strKeyPath = "System\CurrentControlSet\Services\Tcpip\Parameters "
strValueName = "HostName"
objRegistry.SetStringValue
HKEY_LOCAL_MACHINE,strKeyPath,strValueName,newname .value
strValueName = "NV HostName"
objRegistry.SetStringValue
HKEY_LOCAL_MACHINE,strKeyPath,strValueName,newname .value
EggHeadCafe - .NET Developer Portal of Choice
http://www.eggheadcafe.com
.
- Follow-Ups:
- Re: compiling a script
- From: Jeffery Hicks [MVP]
- Re: compiling a script
- Prev by Date: Reading creation date of CDs/DVDs?
- Next by Date: Re: compiling a script
- Previous by thread: Reading creation date of CDs/DVDs?
- Next by thread: Re: compiling a script
- Index(es):
Relevant Pages
|
Loading