powershell for rename server name
Posted OS Knowledge Base
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell for rename server name相关的知识,希望对你有一定的参考价值。
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 = "domainadmin"
$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的主要内容,如果未能解决你的问题,请参考以下文章
PermissionError: [Errno 1] for os.rename as quick action
shell function/for in/for (())/string concat/has dir/rename using regex/if(())/exit/execute command