User Tools

Site Tools


computing:windows:rename_pc

Change Windows Hostname

  • 'netdom' is for machines on an AD domain
  • Use quotes around 'newname'
  • Reboot afterwards

CLI

wmic computersystem where caption='currentname' rename 'newname'

Then reboot to activate the new hostname:

shutdown -r -t 0

WHS script:

Set objWMIService = GetObject("Winmgmts:root\cimv2")

For Each objComputer in _
    objWMIService.InstancesOf("Win32_ComputerSystem")

    objComputer.rename "NewComputerName", NULL, NULL 
Next
computing/windows/rename_pc.txt · Last modified: 2021/09/14 10:54 by gcooper