changing computer name from command line is much needed when group policy restrict admin user from changing computer name in GUI using “computer properties”,
windows 2008 and windows 7 allows to change the computer name from command line as follow:
1. Go to Start < Go to Run < type “cmd” < press “run”.
2. On command line type ‘hostname’.
3. copy the output you got to notepad or paper. This is your windows default computer or server name.
4. On command line type the following text:
namenetdom renamecomputer <hostname> /newname:<New Computer Name>
while under the <hostname> you should type the output from section 3.