You have a hardcoded domain name "lab.com" in the script. You might want to have the user enter it as a parameter., or auto discover it. Perhaps use [System.DirectoryServices.ActiveDirectory.Domain]::GetComputerDomain().Name.ToString() for this (haven't verified it).