Sign in to follow this  
Followers 0
AcidHeat79

Change Computer Name script

6 posts in this topic

#1 ·  Posted (edited)

I've been looking around for a while, to get a smooth way to change

computer name remotely. I know that there are utils that does that, but

I'm really looking for a simple command line with parameters, if exists?

Using registry (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName)

works after reboot, with some side effects (If you check in control

Panel->System it will keep show you old name, although system uses new

name). Any explanations how to fix that?

RegWrite ( "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName", "ComputerName", "REG_SZ", "Cockstand101XP")

What do i add after this? How to command a reboot or will this work in the first place when we just change the registry.

Should i also alter the active computer name too by adding another line in AutoIT script?

RegWrite ( "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName", "ComputerName", "REG_SZ", "Cockstand101XP")

Coz actually i want it to prompt as a pop-up box asking me to enter the value as this is for many many pc. At least users can enter what i instruct them to enter.

Edited by AcidHeat79

Share this post


Link to post
Share on other sites



Why not search the complete registry for the old computer name and change all those values?

Share this post


Link to post
Share on other sites

Here is what I use on XP boxes

Func _RenameComputer($mname)
    RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName", "ComputerName", "REG_SZ", $mname)
    RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName", "ComputerName", "REG_SZ", $mname)
    RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters", "Hostname", "REG_SZ", $mname)
    RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters", "NV Hostname", "REG_SZ", $mname)
    ;next line is not really needed, but makes things easier during initial config.  It just sets the default domain to the new local machine name.
    RegWrite("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultDomainName", "REG_SZ", $mname)
EndFunc   ;==>_RenameComputer

You will still have to reboot before it will work.

If you are running additional network protocols (Novell, etc...) there may be other locations that need patching. This should work for a standard TCP/IP network.

Share this post


Link to post
Share on other sites

Why not search the complete registry for the old computer name and change all those values?

ok lets say i have a few registry key that i need to change...

How can it be customise as 5 users will have to change to a different name when running the script...

I thought of this script to run, a pop-up prompting what to enter as computername...

Then all registry being copied to what is being entered, then reboot iniated...with a message box prompting to save all work, and "REBOOT" with and OK button flag 0.

But i dont know how to write it.

Share this post


Link to post
Share on other sites

ok lets say i have a few registry key that i need to change...

How can it be customise as 5 users will have to change to a different name when running the script...

I thought of this script to run, a pop-up prompting what to enter as computername...

Then all registry being copied to what is being entered, then reboot iniated...with a message box prompting to save all work, and "REBOOT" with and OK button flag 0.

But i dont know how to write it.

anyone?

Share this post


Link to post
Share on other sites

There is also _SetComputerName function of Jscript ! Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0