I’m guessing Ned will insert something like “Hello, Warren here again”. [Nope – Ned]
The other day I was working with server core and wanted to rename my server. Recently I have been working more with WMIC to get data from the DFSR service so I thought why not try WMIC?
Renaming a computer with WMIC
To rename a computer we can use the “Rename” method of the “Win32_ComputerSystem” WMI class. The command looks like this:
WMIC ComputerSystem where Name=COMPUTERNAME call Rename Name=NewName
Don’t forget to reboot as you will not be prompted to restart the system.
Netdom can do the same thing
Don’t forget that you can also rename a computer using Netdom. You may find the Netdom method more user friendly if you are just renaming one system. Using WMIC may come in handy if you need to script the renaming of several machines or just want show off your “skills” to coworkers.
325354 How To Use the Netdom.exe Utility to Rename a Computer in Windows Server 2003 – http://support.microsoft.com/default.aspx?scid=kb;EN-US;325354
Netdom is part of the Support Tools for Windows 2003. In Windows 2008 it is included in the OS install.
“Invalid Global Switch” error
I noticed while working with renaming a computer with WMIC I would sometimes get an “Invalid Global Switch” error. After digging a bit I found that WMIC does not handle special characters. If there are dashes in any of the names used the command will fail unless they are enclosed with quotes. Just so happens I always use dashes in my computer names. So if the command was formatted as shown below it would fail.
WMIC ComputerSystem where Name=COMPUTER-NAME call Rename Name=NewName
To get this command to run you would need to enclose the name in quotes
WMIC ComputerSystem where Name=“COMPUTER-NAME” call Rename Name=NewName
This command also takes environment variables, so if you have been using SYSPREP and have computer names that are gross, you can save time by using the %computername% variable:
Happy computer renaming!
– Warren Allen Williams