PC Review


Reply
Thread Tools Rate Thread

how to change a computers name by script

 
 
Hein Heinrichsen
Guest
Posts: n/a
 
      11th Oct 2005
Hello
does anyone know how to change a computers name by script?
Thanks
Hein
 
Reply With Quote
 
 
 
 
foxidrive
Guest
Posts: n/a
 
      11th Oct 2005
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
 
Reply With Quote
 
Hein Heinrichsen
Guest
Posts: n/a
 
      12th Oct 2005
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
>
>

 
Reply With Quote
 
Pete
Guest
Posts: n/a
 
      12th Oct 2005
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
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Subforms does not load on all computers via script. Billy Van Rensburg Microsoft Access VBA Modules 1 9th Mar 2010 11:41 AM
Find computers, which are not disabled, in AD via script Rytis Microsoft Windows 2000 Active Directory 4 22nd May 2008 10:14 PM
Computers groups and logon script =?Utf-8?B?TWFyYyBWaWxsYW5vdmE=?= Microsoft Windows 2000 Group Policy 4 16th Jun 2005 05:56 AM
BUG: Script blocking does not recognize change in script contents Jonathan K. Shay Spyware Announcements 0 29th Apr 2005 03:37 PM
logon script won't work on some computers Chris Microsoft Windows 2000 Active Directory 1 14th Oct 2003 04:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:45 PM.