Windows OS Hub
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server 2025
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
    • Proxmox
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows 10
    • Windows Server 2025
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
    • Proxmox
  • PowerShell
  • Linux

 Windows OS Hub / Windows 10 / How to Change Computer Name (Hostname) in Windows

January 19, 2024

How to Change Computer Name (Hostname) in Windows

Once you have installed Windows Server or a Windows 10 desktop machine, you will need to change the default name of the computer (hostname). It is usually recommended to include its location or role in the hostname, like mun-dc01, wks-skmIT13, MUNTG02, etc. Also, You can use the serial or inventory number of the device as the computer name.

Contents:
  • Change the Name of a Computer Using the Windows GUI
  • How to Rename a Computer with PowerShell

During the installation, Windows generates a computer name, for example, DESKTOP-P12DNFQ. The hostname contains 15 characters, the first seven characters are taken from your organization name, and the rest are randomly generated. For a home computer, the name is not usually important, but if a computer is located in an organization and works as a part of a workgroup or an AD domain, it is better to set a meaningful computer name. In this article, we will show you how to rename a Windows machine hostname.

A computer name must meet the following requirements:

  • Must not exceed 15 characters;
  • It must not include any special characters (< > ; : » * + = \ | ? ,). Dashes and underscores can be used;
  • It must not contain only numbers;
  • A computer name is not case-sensitive;
  • If the computer is to be joined to an Active Directory domain, the computer name must be unique within the domain.

Change the Name of a Computer Using the Windows GUI

In the latest versions of Windows 10 and 11, you can use the Settings panel to rename your computer.

  1. Press Win+I and go to System -> About (you can use the ms-settings:about URI command to quickly access the Settings); Rename this PC from Windows Settings app
  2. Click Rename this PC;
  3. Enter a new computer name and click Next; set new computer name
  4. Restart your computer to apply the changes.

You can also change the hostname from the classic System Properties interface in Windows:

  1. Press Win+R keyboard shortcut and run sysdm.cpl or systempropertiescomputername command;
  2. Here you will see the current name of your computer and your domain or workgroup name; Change computer name using Control Panel in Windows
  3. Click Change, enter a new computer name, and save the changes. change the hostname
  4. Restart Windows.

You can change the computer name using the Server Manager on Windows Server. Open the Local Server section and click the name in the Computer Name box.

WIndows Server Manager - change name

How to Rename a Computer with PowerShell

You can rename a computer from the command prompt using the Rename-Computer PowerShell cmdlet.

Open a PowerShell console as an administrator. Check the current hostname using the command

$env:computername

Or:

hostname

If you want to get the computer’s FQDN:

$env:computername.$env:userdnsdomain

get hostname cmd windows

To change the computer name:

Rename-Computer -NewName "WKS-SKMO12S3"

Then you can restart the machine using the Restart-Computer command (or you can add a restart option to the command):

Rename-Computer -NewName WKS-SKMO12S3 –Restart -Force

Rename-Computer PowerShell cmdlet

After the reboot, check that the computer name has been successfully changed.

If this computer was a member of the Active Directory domain and was located in an OU (Organization Unit) before the name change, its computer account will still be in the same container, but with a new name. You can check this using the ADUC console. To rename a computer in AD, your account must be delegated permissions to create and delete computer objects in that OU.

Rename computer in Active Directory OU

The Rename-Computer cmdlet allows to change the name of a remote machine:

Rename-Computer -ComputerName "mun-test" -NewName "mun-preprod02" -DomainCredential woshub\maxbak_adm –Force

WMI is used to connect to the remote computer, so if it is disabled on the remote host or the network ports are blocked, an error will occur:

Rename-Computer : Cannot establish the WMI connection to the computer ‘priorauthdes’ with the following error message: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

You can use PowerShell Remoting commands to connect to a remote computer. If you have manually enabled Windows Remote Management or configured WinRM by using GPO on a remote computer, you can use the Invoke-Command to run a command on a remote computer. To change the name of a remote computer, run the following command:

Invoke-Command -ComputerName mun-test -ScriptBlock { Rename-Computer -NewName mun-preprod02 –Restart -Force}

Previously, the netdom command was used to change the machine’s hostname:

  • Rename a local computer: netdom renamecomputer localhost /newname mun-preprod02 /reboot
  • Rename a remote computer: netdom renamecomputer mun-test /newname:mun-preprod02 /userd:woshub\maxbak_adm /password:*

You can change a computer name on Windows Server Core by using the built-in pseudo-graphical sconfig tool.

If you are deploying a reference Windows image to computers using automated installation tools (WDS, SCCM, or over the network using PXE), you can add a small script to them to automatically change a computer name according to your organization’s naming policies.
0 comment
0
Facebook Twitter Google + Pinterest
Questions and AnswersWindows 10Windows 11Windows Server 2019
previous post
Deploying Microsoft Office Language Packs
next post
Get All SMTP (Email) Addresses Using PowerShell in Exchange

Related Reading

How to Allow Multiple RDP Sessions on Windows...

March 15, 2024

How to Run Program without Admin Privileges and...

June 8, 2023

Wi-Fi (Internet) Disconnects After Sleep or Hibernation on...

March 15, 2024

How to Install Remote Server Administration Tools (RSAT)...

March 17, 2024

Refresh AD Groups Membership without Reboot/Logoff

March 15, 2024

Fix: BSOD Error 0x0000007B (INACCESSABLE_BOOT_DEVICE) on Windows

March 17, 2024

Fix: Can’t Extend Volume in Windows

March 11, 2024

How to Delete Old User Profiles in Windows

March 15, 2024

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Recent Posts

  • Encrypt Any Client-Server App Traffic on Windows with Stunnel

    June 12, 2025
  • Failed to Open the Group Policy Object on a Computer

    June 2, 2025
  • Remote Desktop Printing with RD Easy Print Redirection

    June 2, 2025
  • Disable the Lock Screen Widgets in Windows 11

    May 26, 2025
  • Configuring Windows Protected Print Mode (WPP)

    May 19, 2025
  • Map a Network Drive over SSH (SSHFS) in Windows

    May 13, 2025
  • Configure NTP Time Source for Active Directory Domain

    May 6, 2025
  • Cannot Install Network Adapter Drivers on Windows Server

    April 29, 2025
  • Change BIOS from Legacy to UEFI without Reinstalling Windows

    April 21, 2025
  • How to Prefer IPv4 over IPv6 in Windows Networks

    April 9, 2025

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • 0x80244010 Exceeded Max Server Round Trips: Windows Update Error
  • Shutdown/Restart Windows using Command Prompt and PowerShell
  • How to Force Remove a Printer That Won’t Uninstall on Windows
  • Fix: Windows Update Tab (Button) is Missing from Settings
  • How to Completely Remove/Uninstall a Driver in Windows
  • Fix: Windows Needs Your Current Credentials Pop-up Message
  • How to Disable or Uninstall Internet Explorer (IE) in Windows
Footer Logo

@2014 - 2024 - Windows OS Hub. All about operating systems for sysadmins


Back To Top