Windows — Rename Computer via PowerShell
Rename-Computer is the PowerShell way to change a hostname. It works locally and against remote machines without needing to touch System Properties.
Run PowerShell as Administrator.
Check the Current Hostname
Rename and Restart Immediately
The machine renames itself and reboots. The new name is active after the restart.
Rename Without Immediate Restart
The change is staged but not applied until the next reboot. Restart when convenient:
Rename a Remote Computer
Rename-Computer -ComputerName "old-hostname" -NewName "new-hostname" -LocalCredential domain\admin -Restart
This does not require PowerShell remoting to be enabled on the target.
Domain-Joined Machines
Renaming a domain-joined machine requires domain credentials:
You will be prompted for the password if you omit it from the credential object.
AD propagation
After the reboot, allow a few minutes for the name change to replicate through Active Directory before using the new name for remote connections.
Naming Rules
- Allowed characters: letters (
a–z,A–Z), digits (0–9), hyphens (-) - No spaces, no dots
- Maximum 63 characters (DNS limit)
- NetBIOS limit: 15 characters — names longer than 15 are truncated in older Windows networking and AD
Verify After Reboot
Or from another machine: