Jump to content

Change Computer Name script


Recommended Posts

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
Link to comment
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.

Link to comment
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.

Link to comment
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?

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...