Tag Archives: powershell

How to rename a computer remotely using PowerShell

  1. Introduction
  2. The PowerShell command
  3. Tl;dr


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.

Powershell ISE window showing the command

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‘.

Windows powershell credential request

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.

Powershell ISE window showing the command

That’s all there is to it!


Rename-computer –computername “oldname” –newname “newname” –domaincredential administrator –force