Add-PSSnapin Quest.ActiveRoles.ADManagement To disconnect at the end of session : Disconnect-QADService $pw = read-host "Enter password" -AsSecureString