How to rename computer name using PowerShell
In this lesson, we will learn how to rename a Windows Server 2022 computer using PowerShell. This is a must have skill, because it is easy to rename a computer using PowerShell for servers running Server Core Operating System versions.
Step 1 - After logging-in as administrator in your Windows Server, enter option 15 to move to PowerShell console from SConfig console. Please refer below image to know how to move to PowerShell console from SConfig console.
Step 2 - If you want to know the current computer name (host name), use hostname command as shown below to know the current computer name. In this case, current computer name is a randomly generated one, during installation. We need to change this computer name to some meaningful name, so that we can manage the server in a better way.
hostname
Step 3 - To change the computer name using PowerShell, use Rename-Computer PowerShell cmdlet, as shown below.
Rename-Computer -NewName OmniSecu-Serv04
Step 4 - Now, we need to restart the computer to apply the computer renaming in effect. Use "Restart-Computer" PowerShell cmdlet, as shown below to restart the computer.
Restart-Computer
Step 5 - Once the server computer has restarted, again use the "hostname" command to verify the computer name is changed, as shown in below image.
hostname
Written by Jajish Thomas.
Last updated on 9th April, 2022.