Rename desktops in Windows domain from command line

article #31, updated 534 days ago

The simplest appears to be thus:

wmic computersystem where caption='oldcomputername' rename newcomputername

If it is run from an administrative CMD and the machine is in good talking relationship with its domain controller, the PC and also AD rename will complete. If either prerequisite is not met, the rename will fail. A non-admin attempt fails with code 5, DC availability fails with 1355.

There is also tool, part of the 2003 server reskit and included later on, which can do the rename of a desktop from a domain controller:

NETDOM RENAMECOMPUTER OLDNAME /newname:NEWNAME /userd:domain\domainadmin /passwordd:password /force /reboot:0

It causes a reboot of the target machine. /reboot:0 means no delay; the number is in seconds.