Is it possible to change the hostname in Windows 2003 from the command line with out-of-the-box tools?
How to change your PC Name via Command Prompt? 1) Press the Windows key + X to open the Quick Access menu. Then, click on Command Prompt (Admin). 2) In the Command Prompt, type WMIC computersystem command to change your computer name, assuming you know the current computer name.
The previously mentioned wmic
command is the way to go, as it is installed by default in recent versions of Windows.
Here is my small improvement to generalize it, by retrieving the current name from the environment:
wmic computersystem where name="%COMPUTERNAME%" call rename name="NEW-NAME"
NOTE: The command must be given in one line, but I've broken it into two to make scrolling unnecessary. As @rbeede mentions you'll have to reboot to complete the update.
cmd (command):
netdom renamecomputer %COMPUTERNAME% /Newname "NEW-NAME"
powershell (windows 2008/2012):
netdom renamecomputer "$env:COMPUTERNAME" /Newname "NEW-NAME"
after that, you need to reboot your computer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With