
Changing the hostname of a Windows Server is a common administrative task that can be done using various methods. This guide will walk you through the steps to change the hostname on Windows Server 2022 and 2025 using both the graphical user interface (GUI) and PowerShell.
Prerequisites
- Administrative privileges on the server.
- Access to the server either physically or via remote desktop.
Method 1: Using the Graphical User Interface (GUI)
Steps:
- Open Server Manager:
- Click on the Start menu.
- Select Server Manager.
- Access Local Server:
- In the Server Manager dashboard, click on Local Server in the left-hand pane.
- Change Computer Name:
- In the Properties section, click on the current Computer Name.
- The System Properties window will open. Click on the Change button.
- Enter New Hostname:
- In the Computer Name/Domain Changes window, enter the new hostname in the Computer name field.
- Click OK.
- Restart the Server:
- You will be prompted to restart the server. Click Restart Now to apply the changes.
Verification:
- After the server restarts, open Server Manager again and verify that the new hostname is displayed under Local Server.
Method 2: Using PowerShell
Steps:
- Open PowerShell:
- Click on the Start menu.
- Type PowerShell and select Windows PowerShell.
- Run Rename-Computer Command:
- In the PowerShell window, type the following command:
Rename-Computer -NewName "NewHostname" -Force -PassThru
- Replace
"NewHostname"
with the desired hostname.
- In the PowerShell window, type the following command:
- Restart the Server:
- To apply the changes, restart the server using the following command:
Restart-Computer
- To apply the changes, restart the server using the following command:
Verification:
- After the server restarts, open PowerShell and run the following command to verify the hostname:
hostname
Additional Tips
- Ensure that the new hostname complies with your organization’s naming conventions.
- If the server is part of a domain, you may need to update the DNS records to reflect the new hostname.
- Always perform these changes during a maintenance window to avoid disrupting services.