Hein Heinrichsen
10-11-2005, 05:41 PM
Hello
does anyone know how to change a computers name by script?
Thanks
Hein
foxidrive
10-11-2005, 05:58 PM
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.aspx?scid=kb;en-us;298593&sd=tech
Hein Heinrichsen
10-12-2005, 07:10 PM
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.aspx?scid=kb;en-us;298593&sd=tech
>
>
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" <Heinrichsen@web.de> wrote in message
news:%23yRhtg1zFHA.1968@TK2MSFTNGP10.phx.gbl...
> 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.aspx?scid=kb;en-us;298593&sd=tech
>>