Rename Windows Computer
6 Votes |
Description
We can rename a windows computer from command line using WMIC computersystem command. Please see the command below
WMIC computersystem where caption='currentname' rename newname
Example: If the current computer name is XP-PC, to change it to Windows7-PC, we can run the below command.
wmic computersystem where caption='xp-pc' rename windows7-pc
After running the command, you need to reboot the computer to make the changes effective.
This command works on XP, Vista, Windows 7 and also on Server 2003 and Server 2008 editions.
Property Details
1393 | |
Rename Windows Computer | |
BESC | |
Configuration | |
0 | |
danielheth@bigfix.me | |
<Unspecified> | |
<Unspecified> | |
1/30/2013 12:00:00 AM | |
PRE command WMIC rename computer | |
True | |
danielheth on 1/30/2013 1:19:17 PM | |
danielheth on 1/30/2013 1:19:17 PM | |
17949 Views / 209 Downloads | |
![]() ![]() ![]() ![]() ![]() |
Relevance
Actions
Action 1 (default)
Action Link Click
here to deploy this action.
Script Type
BigFix Action Script
//ask admin for name of new computer
action parameter query "newComputerName" with description "Please enter the new Computer Name (Ex: Daniel-PC):" and with default value ""
//use WMI to change the name
waithidden wmic computersystem where caption='{computer name as string}' call rename '{parameter "newComputerName" as string}'
continue if {exit code of action = 0}
//flag action as requiring a restart
action requires restart
Success Criteria
This action will be considered successful when the applicability relevance evaluates to false.
Action 2
Action Link Click
here to Command Reference.
Script Type
URL
http://www.windows-commandline.com/2011/10/change-computer-name-command-line.html
Sharing
Social Media: |
Comments
![]() |
|
I will test it. Thank you |
![]() |
|
You are correct. There is also the possibility of setting the current computer name in a parameter and then checking that it doesn't match after reboot. |
![]() |
|
This fixlet should probably have the success criteria changed to: "...all lines of the action script have completed successfully." |