Rename Windows Computer
Log In or Register to download the BES file, and more.

4 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

ID1393
TitleRename Windows Computer
DomainBESC
CategoryConfiguration
Download Size0
Sourcedanielheth@bigfix.me
Source ID<Unspecified>
Source Severity<Unspecified>
Source Release Date1/30/2013 12:00:00 AM
KeywordsPRE command WMIC rename computer
Is TaskTrue
Added by on 1/30/2013 1:19:17 PM
Last Modified by on 1/30/2013 1:19:17 PM
Counters 11893 Views / 157 Downloads
User Rating 1 star 2 star 3 star 4 star 5 star * Average over 2 ratings. ** Log In or Register to add your rating.

Relevance

isWindows (Relevance 274)
Used in 227 fixlets and 3 analyses   * Results in a true/false
Show indented relevance
name of operating system starts with "Win"
Used in 1 fixlet   * Results in a true/false
Show indented relevance
exists file "wmic.exe" of folder "wbem" of system folder

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:
Share this page on Yammer

Comments

Log In or Register to leave comments!
jgstew -
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.
rdshift -
This fixlet should probably have the success criteria changed to: "...all lines of the action script have completed successfully."