Powershell: Join VM to the Domain
## Description: This script will join a computer to a domain and force a reboot
$domain = "lab.local"
$username = "$domain\username"
$password = Read-Host 'What is your password?' -AsSecureString
$credential = New-Object System.Management.Automation.PSCredential($username,$password)
Add-Computer -DomainName $domain -Credential $credential
Write-Host ("Computer joined domain " + $domain)
gpupdate /force
shutdown -r -f -t 60