PowerShell: Rename/Change A Windows Computer Name

PowerShell

Purpose: Rename a standalone or domain member Windows computer.

Rename A Domain Member Computer Remotely:

From a member server or workstation, run the following Rename-Computer command in a PowerShell window. A credentials prompt will be presented to enter the password for the specified account in the -DomainCredential parameter.

Rename-Computer -ComputerName "<old-computer-name>" -NewName "<new-computer-name>" -DomainCredential <DOMAIN>\<domain-admin> -Force [-Restart]

Rename A Domain Member Computer Locally (Directly On The Computer):

Run the following Rename-Computer command in a PowerShell window:

Rename-Computer -NewName "<new-computer-name>" -DomainCredential <DOMAIN>\<domain-admin> -Force [-Restart]

Rename A Standalone Computer Locally (Directly On The Computer):

Run the following Rename-Computer command in a PowerShell window:

Rename-Computer -NewName "<new-computer-name>" -Force [-Restart]

Notes:
<old-computer-name> : Current computer name of existing server/workstation
<new-computer-name> : New computer name to rename existing server/workstation to
<DOMAIN> : Active Directory domain name
<domain-admin> : User account with domain administrator privileges
<-Restart> : Optional parameter to immediately restart the computer after renaming

References:
Rename-Computer (Microsoft.PowerShell.Management) – PowerShell | Microsoft Docs

Related:

Leave a comment