标签:nbsp text tom admin computer server rest ini ring
Rename server name if server has not yet joined AD
$Hostname = "newname"
$username = "Administrator"
$Password = "xxxxxxxx"
$pwd = $Password | ConvertTo-SecureString -asPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($UserName,$pwd)
Rename-Computer -NewName $Hostname -LocalCredential $credential -Restart
Rename server name if server has already joined AD
$Hostname = "newname"
$username = "domain\admin"
$Password = "xxxxxxxx"
$pwd = $Password | ConvertTo-SecureString -asPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($UserName,$pwd)
Rename-Computer -NewName $Hostname -DomainCredential $credential –Restart
powershell for rename server name
标签:nbsp text tom admin computer server rest ini ring
原文地址:https://www.cnblogs.com/oskb/p/9506539.html