• Health tips to prevent the spread of COVID-19:
    • Wash your hands frequently;
    • Maintain 2 meters social distancing;
    • Minimise outdoor activities.
    Stay safe in your bubble!

Rename Windows computer name from the command line

Andy

Administrator
User ID
1
Joined
7 Jan 2019
Messages
243
Reaction score
8
Points
18
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:
Top