A hostname is a unique identifier that is assigned to a device (host) which connected to the network. It provides a way to differentiate one device from another on a specific network. This tutorial shows 2 methods how to change hostname on Windows.
Method 1 - CMD
Assign new hostname to variable:
set NEW_HOSTNAME=john-pc
To change hostname, run the wmic
command as administrator:
wmic computersystem where name="%computername%" call rename name="%NEW_HOSTNAME%"
Reboot system to apply changes.
Method 2 - PowerShell
Assign new hostname to variable:
$NEW_HOSTNAME='john-pc'
Execute the Rename-Computer
command as administrator, to change hostname:
Rename-Computer -NewName "$NEW_HOSTNAME"
To make changes to take effect, reboot the system.
Leave a Comment
Cancel reply