- This topic has 1 reply, 2 voices, and was last updated 2 months, 2 weeks ago by
March 6, 2020 at 2:49 pm #208827ParticipantTopics: 2Replies: 0Points: 24Rank: Member
I created a script to copy AD permissions from one user to another or existing user.
For some reason the script didn’t work well I inserted the variable of the user name from which I want to copy but it can’t find me.
It is important to note that in AD I have USERS, a sub-OU of users like OU of Public, Private
# import the Active Directory module in order to be able to use get-ADuser and Add-AdGroupMembe cmdlet import-Module ActiveDirectory # enter login name of the first user $copy = Read-host "Enter username to copy from: " # enter login name of the second user $paste = Read-host "Enter username to copy to: " # copy-paste process. Get-ADuser membership | then selecting membership | and add it to the second user get-ADuser -identity $copy -properties memberof | select-object memberof -expandproperty memberof | Add-AdGroupMember -Members $paste
This is an error message I receive:
Add-AdGroupMember : Insufficient access rights to perform the operation At line:11 char:101 + ... memberof -expandproperty memberof | Add-AdGroupMember -Members $paste + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (CN=CPT Helsinki...ba,DC=gov,DC=il:ADGroup) [Add-ADGroupMember], ADException + FullyQualifiedErrorId : ActiveDirectoryServer:8344,Microsoft.ActiveDirectory.Management.Commands.AddADGroupMember
March 6, 2020 at 5:55 pm #208905Senior ModeratorTopics: 3Replies: 123Points: 653Rank: Major Contributor
For the purpose of troubleshooting, you should verify that this part works by itself:
get-ADuser -identity $copy -properties memberof
That is, comment out the rest of the line after that and verify that
Get-ADUseris actually finding the user based on the input you collect in
For the error you’re getting, it seems pretty straightforward – you do not have permission to add AD group members. Try running it as administrator.
- You must be logged in to reply to this topic.