Powershell 加域操作,简单快捷。

$pwd_local = ConvertTo-SecureString "pass01!" -AsPlainText -Force
$pwd_Domain = ConvertTo-SecureString "pass01!" -AsPlainText -Force

$cred_local = New-Object System.Management.Automation.PSCredential("administrator",$pwd_local)
$cred_domain = New-Object System.Management.Automation.PSCredential("coso\administrator",$pwd_local)

Add-Computer -NewName H2019-host01 -DomainName coso.cn -LocalCredential $cred_local -DomainCredential $cred_domain -Verbose # -Restart -Force


Powershell 加域_Powershell