A hostname is a unique identifier for a device in a network. You might sometimes need to change the existing hostname of your machine. This article will discuss two ways to change hostname in Windows: through GUI and Powershell. This article has been written from the Windows Server 2019 version. However, feel free to follow the same steps on the 2016 and 2012 R2 versions.

What is hostname

A hostname is a one-of-a-kind name or label associated with a device connected to a computer network. It makes it easier to distinguish between different machines or devices that are connected to the Internet, a network, or both. The naming system is used to allocate and assign hostnames.

A hostname can be alphabetic or alphanumeric, and it can contain a limited number of symbols that are used to identify a specific network node or device. The syntax and requirements of a hostname differ depending on the naming system in use. A hostname, for example, should have the top-level domain name (TLD) and should be in the range of [1, 63] characters long when used in the Domain Name System (DNS) or on the Internet.

Steps to change the hostname (using GUI)

Step 1

Go to Control Panel -> System and Security -> System and select the Change Settings option.

Alternatively, you can right-click This PC from the start menu, select Properties and select the Change Settings option.

A dialogue box named System Properties will pop up after either of the above steps.

Step 2

Click on the Change button to get a new dialogue box to enter the new hostname.

Step 3

Once you have inserted the new name, click OK to apply the changes and again click OK to restart the computer.

When the machine is up again, you will see the hostname updated.

Steps to change the hostname (using Powershell)

Run the following command in the PowerShell:

Rename-Computer -NewName "MyNewName" -Restart

-Restart parameter will restart the machine after changing the name.

To verify if the name was changed:



In this article, we discussed two ways to change the hostname of the Windows server. The GUI approach is easier to understand and is helpful for novices, while the Powershell approach is less frequently used as it requires knowledge of the command-line interface.