Join to domain powershell script

Join to domain powershell script

$username = "domainadmin"
$Password = "xxxxxxxx"
$pwd = $Password | ConvertTo-SecureString -asPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($UserName,$pwd)
$Domain = "domain.com"
Add-Computer -DomainName $Domain -Credential $credential –Restart
原文地址:https://www.cnblogs.com/oskb/p/9369852.html