Rename Windows computer name from the command line

Andy

Administrator
Creative Team
User ID
1
Joined
7 Jan 2019
Messages
1,192
Reaction score
59
Points
48
For any reason, if you need to rename Windows computer name from the command line, here's the command:
Code:
WMIC computersystem where name="%computername%" call rename name="NewComputerName"

Example output:
Code:
C:\WINDOWS\system32>WMIC computersystem where name="OldComputerName" call rename name="NewComputerName"
Executing (\\OldComputerName\ROOT\CIMV2:Win32_ComputerSystem.Name="OldComputerName")->rename() Method execution successful. Out Parameters: instance of __PARAMETERS {    ReturnValue = 0; };
For the change to take effect, restart the computer using the command:
Code:
C:\WINDOWS\system32>shutdown /r /t 0
I tested running the commands above from ScreenConnect v21.4.2455.7731, and it worked as expected.
 
 Short URL:
Back
Top