compiling a script



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
.



Relevant Pages

  • Targeting VBScript to rename PCs
    ... Remove aged accounts, Move Computers to the correct OU ... I have the script for the last one working ... 'Rename PC and domain machine account ...
    (microsoft.public.scripting.vbscript)
  • Re: Remotely rename computer name and join to domain
    ... go to every single computer and rename it and wait and then ... If this is some unattended installation - why not script it and have it ... If you are joining old computers to a new domain - then why not script it so ...
    (microsoft.public.windowsxp.security_admin)
  • Re: force a script to resume before it is ready
    ... strState = "Offline" ... This is part of my FTP script that connects to multiple Computers (as ... trying to rename a file that does not exist. ...
    (microsoft.public.scripting.vbscript)
  • Re: Can I rename computers through AD?
    ... You cannot rename computers from the AD consoles. ... For WinXP you can use NETDOM which you can script to ... If you have Win2K, however, you cannot use netdom. ...
    (microsoft.public.win2000.active_directory)
  • Re: Finding users in local admin groups
    ... > Here is a vbscript that you can run against a remote computer that moves ... > *local* users except 'Administrator) from the Administrators group to the ... You should also add to the script logging to a file of the ... > you moved on what computers. ...
    (microsoft.public.win2000.security)

Loading