One of those “magics” you may want to experiment in the lab or perhaps impress some of your colleges, IT guys within your company, who knows? It's the function to rename computer remotely. This operation however needs some downtime on the other end as the system will obviously needs to reboot. The fun part on that is that you can very easily save the one-liner for later use or do a simple modification of the name of the system you want to change each time, and use it on multiple occasions. Any special tools aren't needed.
The operation is simple and you don't need any tools to be installed if executed from a system that has netdom.exe utility installed. This Microsoft utility is by default on Windows Server 2012 R2 AFAIK, but you can find it via the support tools on older Server OS (2003 server etc…) . Te Netdom.exe utility can also be used to join or remove computer to/from a domain and other tricks, like for resetting the communication channel in case that the Trust Relationship Between Workstation and Domain Fails.
Here is the command I used in the lab. We are renaming computer named 2008srvNew to 2008srv:
netdom renamecomputer 2008srvNew /newname:2008srv /userD:lab1administrator /passwordd:1111 /usero:lab1administrator /passwordo:1111 /reboot:60
Explications of the different sub-commands, but it's pretty self-explanatory…
- Renamecomputer – command used to rename the system. In our case the remote system has name 2008srv.
- Newname – name of the computer will have after the rename.
- UserD – Domain user with administrative priviledges to the computer object in the domain.
- UserO – is a user that has local administrative permissions, which can be the same account specified for /userd: (the screenshot above uses the same one… )
- reboot/value – Time before automatic reboot in seconds is the amount of time before the computer restarts after renaming the computer. If this parameter is not specified, the computer must be restarted manually
After that you are prompted if you want to validate or not.
Press Y to validate.
On the remote system you'll see a warning that the system will be rebooted. Like this:
General syntax:
netdom renamecomputer machine /newname:new_computername /userd:domainnameadministrator_id /passwordd:* /usero:local_admin
/passwordo:* /reboot:seconds before automatic reboot
A description:
- Machine is the current name of the computer.
- New_computername is the name that the computer is going to have.
- Domainnameadministrator_id is the network basic input/output system (NetBIOS) domain name and the administrator identification (ID) of a user account that has administrative permissions to the computer object in the domain.
- Local_admin is a user that has local administrative permissions, which can be the same account specified for /userd:
- The asterisk symbol (*) is the value that is connected to the /passwordd: and /passwordo: parameters and specifies that the password should be typed with hidden characters when the command is submitted.
- Time before automatic reboot in seconds is the amount of time before the computer restarts after renaming the computer. If this parameter is not specified, the computer must be restarted manually.
As a result we now have our system renamed to 2008srv.
Source: Microsoft
Russ says
Don’t forget the rename-computer cmdlet.