Rename a computer via CMD prompt (locally or over network)
For one reason or another, you need or want to change a computer name via a command prompt either over the network or on the local computer.estore deleted Office 365 mailbox via PowerShell
Open a CMD prompt as administrator on the target computer.
Type the following and press enter:
WMIC computersystem where caption=’CurrentPCName’ rename ‘NewPCName’
If you want to run it over the network, you can type the following and press enter:
WMIC /node:”RemotePC” /user:domain\domainAdminAccount /password:domainAdminPassword computersystem call rename “NewPCName”
ReturnValue = 5; = fail
ReturnValue = 0; = successful
Note that it may fail if firewall rules are not setup correctly. You should also be able to use local admin credentials of the target computer by removing the domain name and ‘\’ from the above string.