2

Change Hostname on Windows Server

 2 years ago
source link: https://www.vultr.com/docs/change-hostname-on-windows-server-best-practices
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
<?xml encoding="utf-8" ??>

Supported Versions

This guide applies to:

  • Windows Server 2019
  • Windows Server 2016
  • Windows Server 2012 R2

Introduction

When creating a new Vultr VPS, you can set the Server Hostname before deployment. If you skip this step or decide to rename your server later, you'll discover that changing the server hostname from the Customer Portal also performs a fresh reinstall of the entire server.

Change Hostname Example Screenshot

Follow this guide if you need to change the server hostname without reinstalling.

Examples

This guide uses OLDDOG for the old hostname and NEWTRICKS for the new hostname.

Change Hostname in PowerShell

  1. Open an elevated PowerShell. If you are in standard PowerShell, elevate your access as shown:

    PS C:\> Start-Process PowerShell -Verb Runas
    
  2. Check the hostname with $env:computername.

    PS C:\> $env:computername
    OLDDOG
    
  3. Change the hostname to NEWTRICKS. Using the -Restart parameter will also immediately restart the server. Full documentation on the Rename-Computer cmdlet is available at Microsoft.

    PS C:\> Rename-Computer -NewName "NEWTRICKS" -Restart
    
  4. Verify the hostname has changed with $env:computername.

    PS C:\> $env:computername
    NEWTRICKS
    

Change Hostname using GUI

  1. Log in to the server via RDP.
  2. Navigate to the "This PC" screen and click "System properties".
  3. Click "Change settings" next to the current computer name.
  4. Click the "Change" button.
  5. Enter a new computer name and confirm by clicking "OK".
  6. Restart the server.

Update DNS

This procedure does not change your DNS name, and you'll need to perform those steps at your domain registrar.

About Hostnames

A hostname is what identifies a server. Most Windows Server users name their servers with the hostname consisting of two parts: role.domain. The role part is the role installed on the server, followed by the number. For example, dc01 if this is the first server that acts as a DC in this particular network. Then, Windows makes this an FQDN by putting the Active Directory domain as the domain part. For example, if this is the third web server in this network, and the domain is example.com, the hostname would be:

ws03.example.com

Note that changing the hostname on Windows Server may conflict with some installed roles. It is a good idea to change the hostname before installing roles on the server. If you decide to change the hostname on a Windows Server with roles installed, make a snapshot first. Therefore, if something breaks, you will be able to restore your server from that snapshot.

Want to contribute?

You could earn up to $600 by adding new articles


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK