I have a chunk of code:
Code: Select all
$UserADObject = Get-ADUser $UserID -properties *
$UserADObject.memberof | ForEach-Object {
$Group = Get-ADGroup $_
Remove-ADGroupMember -Identity $Group.name -Members $UserID -Confirm:$False
}
$MemberList | ForEach-Object {
$Group = Get-ADGroup $_
Add-ADGroupMember -Identity $Group.name -Members $UserID -Confirm:$False
}
Code: Select all
Get-ADGroup: Cannot bind parameter 'Identity'. Cannot convert value "CN=Account Operators,CN=Builtin,DC=my,DC=domain,DC=name" to type "Microsoft.ActiveDirectory.Management.ADGroup". Error: "Cannot convert the "CN=Account Operators,CN=Builtin,DC=my,DC=domain,DC=name" value of type "Deserialized.Microsoft.ActiveDirectory.Management.ADGroup" to type "Microsoft.ActiveDirectory.Management.ADGroup"."
Add-ADGroupMember: Cannot validate argument on parameter 'Identity'. The argument is null. Provide a valid value for the argument, and then try running the command again.