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