Search

How to rename computer using "Rename-Computer" PowerShell Cmdlet

Once the Windows Server Operating System is installed, you may need to change the default random computer name generated by the Windows Server setup program. Before renaming the computer, you may need to view the current name of the Windows Server. You can view the current computer name (before renaming the computer) by running the PowerShell Cmdlet "Get-ComputerInfo" or hostname command in Command Prompt.

You may need to rename a Windows Server using PowerShell, if you have a Server Core installation.

How to find the current computer name in a Server Core installation

We can use the PowerShell Cmdlet "Get-ComputerInfo" to get the current computer name. Run the PowerShell Cmdlet Get-ComputerInfo -Property CsName from the PowerShell terminal, to get the current computer name.

Please refer below image.

get-computerinfo-before-name-change-powershell.jpg

 

You may also use the "hostname" command from the Command Prompt, to find the current computer name.

Please refer below image.

hostname-command-to-find-computername.jpg

 

You can see from the above images that the default computer name generated in a Windows Server computer during installation is a random string starting with "WIN–".

To rename a Windows Server to a meaningful name, we can use the PowerShell cmdlet "Rename-Computer". Use the following format to rename a Windows Server computer, using PowerShell cmdlet Rename-Computer -NewName "OMNISECU-08". The default random computer name generated during the installation will be changed to OMNISECU-08, after running the above PowerShell Cmdlet.

You need to restart the computer after changing the computer name.

rename-computer-powershell.jpg

 

To restart the computer, use the PowerShell Cmdlet "Restart-Computer" from the PowerShell terminal. Please refer the following image.

restart-computer-powershell.jpg

 

Once the server is restarted after renaming the computer name using "Rename-Computer" PowerShell Cmdlet, you can find the changed computer name by running PowerShell Cmdlet "Get-ComputerInfo -Property CsName" again. You can find the computer name is renamed to "OMNISECU-08", as shown in below image.

get-computerinfo-after-name-change-powershell.jpg

 

Written by Jajish Thomas.
Last updated on 29th May, 2024.

 

Related Tutorials
Introduction to Windows Server 2025
Minimum hardware requirements for Windows Server 2025
New features of Windows Server 2025
How to download Windows Server 2025 Preview iso file
How to install Windows Server 2025
Differences between Server Core and GUI (Desktop Experience)
Default GUI tools in Server Core
How to run PowerShell as administrator
How to run PowerShell as administrator in Server Core
How to find the PowerShell version in Server Core and Desktop experience
How to add Network icon to desktop in Windows Server 2025
How to add Computer (This PC) icon to desktop in Windows Server 2025
How to rename a computer using Windows Explorer
How to rename computer using "Rename-Computer" PowerShell Cmdlet
How to configure IPv4 Address in Windows Server 2025
How to configure IPv4 address in Windows Server 2025 using PowerShell Cmdlets
How to configure IPv6 Address in Windows Server 2025
How to configure IPv6 Address in Windows Server 2025 using PowerShell
What is MMC (Microsoft Management Console) and what are MMC snapin files
Add a snapin to MMC console
What are Roles and Features and difference between Roles and Features in Windows Server
Roles in Windows Server
Features in Windows Server
How to add Roles and Features in Windows Server
How to Remove Roles and Features in Windows Server
How to add Roles and Features using PowerShell
How to remove Roles and Features using PowerShell
Different types of computer hardware devices
What is a Driver Software
What is Device Manager and how to open Device Manager
What is Plug and Play (PnP)
How to scan for hardware changes using Device Manager and pnputil.exe
How to disable a device using Device Manager
How to disable a device using PowerShell Disable-PnpDevice Cmdlet
How to enable a device using PowerShell Enable-PnpDevice Cmdlet
How to update drivers using Device Manager
What is Driver Signing in Windows Operating Systems
What is Roll back of a driver and how to Roll Back a driver
How to uninstall a device using Device Manager
What are File attributes in Windows Operating Systems
attrib command in Windows
How to hide files and folders using Windows File Explorer
How to hide files and folders using attrib.exe command
How to view hidden files using Windows File Explorer
What are file name extensions
What are known file extensions and how to view known file extensions
How to associate a file name extension with an app
Hide or Show known file name extensions in Windows Server 2025
Hide or Show protected operating system files in Windows Server 2025
What are multi–user Operating Systems (OS) and multi–task Operating Systems (OS)
What are local user accounts and local groups in Windows Server
Different types of user accounts in Windows Server
How to create a local user in Windows Server
How to create a local user in Windows Server using New-LocalUser PowerShell cmdlet
How to force a local user to change password on next login
How to enable or disable a local user account
How to allow or prevent a local user to change password
What are Security Principals and SIDs
How to find SIDs of local user accounts