When the script (variables formed in progress) powershell encountered an unexpected error:
$Group_DN = "CN=MyGroup1,OU=MyOU1,DC=hq,DC=contoso,DC=com" add-QADGroupMember -identity $Group_DN -member hq\MyUser1
add-QADGroupMember : Cannot resolve directory object for the given identity:
And in a separate window powershell commands are processed normally. First decided to add quotes received a new error:
add-QADGroupMember : Cannot bind parameter 'Identity'. Cannot convert the "" value of type
Then drew attention to the following line in error:
value of type "Microsoft.PowerShell.Commands.MatchInfo" to type "Quest.ActiveRoles.ArsPowerShellSnapIn.Data.IdentityParameter"
And I realized that you just have to convert the variable type
$Group_DN = "CN=MyGroup1,OU=MyOU1,DC=hq,DC=contoso,DC=com" [string]$Group_DN2 = $Group_DN add-QADGroupMember -identity $Group_DN2 -member hq\MyUser1
No comments:
Post a Comment