我的代码提示用户输入$ dom。
$dom = "'DC=my,DC=com'"
Get-QADUser -SearchRoot $dom -SearchScope 'SubTree' -objectattributes @{"EmployeeID"=$eid} |
Select-Object SamAccountName, employeeID, DisplayName, Description, Email, LastLogon, legacyExchangeDN
运行时出现以下错误。
Get-QADUser:从服务器返回推荐。
使用eid.ps1:62 char:12在C:\ My Scripts \ get-user_by + 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
答案 0 :(得分:0)
删除嵌套的单引号解决了这个问题。
$ dom =“'DC = my,DC = com'”