Try something like this...
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\ComputerName"
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
I've used something similar for a while without any problems.
Pete Forman
"Hein Heinrichsen" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hello
> Thank you for your answer but this seems to be only for computers in a
> domain, not in workgroups.
> any other suggestions?
> Hein
> foxidrive wrote:
>
>>On Tue, 11 Oct 2005 18:41:46 +0200, Hein Heinrichsen wrote:
>>
>>
>>
>>>does anyone know how to change a computers name by script?
>>>Thanks
>>>Hein
>>>
>>
>>http://support.microsoft.com/default...298593&sd=tech
>>