Set Computer Name using PowerShell

Yesterday I faced a problem in which I need to change the computer name using PowerShell. First I was looking for some cmdlet which can do this job for me but there is not any builtin cmdlet for it.
This method is using WMI to do the task.

I am using Get-WMI to give me all the value of Win32_ComputerSystem.

You can see in the Output that the “Name” value contain our Computer name.

After putting the command in to the $computerName variable, you can use the rename method to rename the computer.


The Win32_ComputerSystem WMI class contain the method of .Rename() in which we need to provide a desired computer name in brackets.

~Pouyan

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.