#Run in PowerShell:
$cred = New-Object System.Management.Automation.PSCredential("yourDoamin\yourUser",(ConvertTo-SecureString "yourPassword'" -AsPlainText -Force)); Rename-Computer -NewName "yourNewHostname" -DomainCredential $cred -Force
#Run in command prompt (cmd) with PowerShell:
powershell -Command "$cred = New-Object System.Management.Automation.PSCredential('yourDoamin\yourUser',(ConvertTo-SecureString 'yourPassword' -AsPlainText -Force)); Rename-Computer -NewName 'yourNewHostname' -DomainCredential $cred -Force"
#Check:
reg query "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName"