码迷,mamicode.com
首页 > 系统相关 > 详细

powershell for rename server name

时间:2018-08-20 17:19:19      阅读:189      评论:0      收藏:0      [点我收藏+]

标签: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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!