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