Often it can be a tedious venture renaming a computer, particularly on a network, this command will easily rename a machine for you and update it on Active Directory.
The PowerShell command
First things first you will want to run PowerShell, I’m using PowerShell ISE simply because I like to write out a script and then run it afterwards.
Next you want to write out the command ‘Rename-computer –computername “oldname” –newname “newname” –domaincredential administrator –force‘ where ‘oldname‘ is the current name of the machine and ‘newname‘ is the name you wish to change it to. In this case I’m changing it from ‘Odyssey‘ to ‘STORM‘.
Press ‘Enter‘ if using regular PowerShell or press the green play button if using ISE.
Now, you’ll need privilege’s for this which is what the ‘-domaincredential administrator‘ command is for, where ‘administrator‘ is the admin username you will be using, e.g. your network administrator login. Login using an account with the correct permissions and press ‘OK‘.
Once you’ve logged in, the command will run and if it worked correctly you will get a message saying ‘WARNING: The changes will take effect after you restart the computer ‘computer name’.‘ Simply restart the machine and you should find that the name has been changed.
That’s all there is to it!
Rename-computer –computername “oldname” –newname “newname” –domaincredential administrator –force