views:

17

answers:

1

I have code that prompts a user for input for $dom.

$dom = "'DC=my,DC=com'"

Get-QADUser -SearchRoot $dom -SearchScope 'SubTree' -objectattributes @{"EmployeeID"=$eid} | Select-Object SamAccountName, employeeID, DisplayName, Description, Email, LastLogon, legacyExchangeDN

I get the following error when I run this.

Get-QADUser : A referral was returned from the server.

At C:\My Scripts\get-user_by using eid.ps1:62 char:12 + Get-QADUser <<<< -SearchRoot:$dom -SearchScope 'SubTree' -objectattributes @ {"EmployeeID"=$eid} | + CategoryInfo : NotSpecified: (:) [Get-QADUser], COMException + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Ques t.ActiveRoles.ArsPowerShellSnapIn.Powershell.Cmdlets.GetUserCmdlet

A: 

Removing the nested single quotes solved the issue.

$dom = "'DC=my,DC=com'"

rome

related questions