Search notes:

Rename a Windows computer (change hostname)

With PowerShell (and admin privileges)
PS C:> wmic computersystem where name=`"$env:computername`" call rename `"new-computer-name"
Method execution successful.
Out Parameters:
instance of __PARAMETERS
{
        ReturnValue = 0;
};
This strange syntax ("…") is necessary in Powershell to quote the ", and the " are necessary if the the computername has special characters such as hyphens.
After executing this command, the system needs to be rebooted for the change to take effect.

See also

HOSTNAME.EXE
wmic computersystem

Index