This script  will take affect after restart

[sourcecode language="powershell"]
$NewName="windowsserver"
$ComputerInfo = Get-WmiObject -Class Win32_ComputerSystem
$ComputerInfo.Rename($NewName)
Restart-Computer

[/sourcecode]