I need to create a Powershell script that sets some user attributes in Active Directory.
I use the Set-AdUser command and pass the user object as follows:
$user = Get-AdUser -Identity $userIdentity
$user.MemberOf = $dn_of_group
Set-ADUser -Instance $user
this returns an error "The adapter cannot set the value of the" MemberOf "property.
Is it possible to set MemberOf property from powershell?
If so, what am I doing wrong?
source
share