Link to home
Start Free TrialLog in
Avatar of Adam Brown
Adam BrownFlag for United States of America

asked on

Powershell - Setting the memberof attribute

We're getting ready to redo our company AD infrastructure. One of the things my boss would like to do is build up some template users with appropriate security group memberships for different user roles and departments in the company. He's asked me to piece together a powershell script that will take the group memberships from one user and apply them to a newly created user. I know I've seen a script somewhere that was able to do something like this, but I can't really remember where I saw it. Any ideas?
ASKER CERTIFIED SOLUTION
Avatar of KenMcF
KenMcF
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Adam Brown

ASKER

Thanks Ken. Was different than what I was thinking of, but that did the trick. And I just about had it figured out myself, too...
if you need the MS cmdlets you can do this, i was going to post before but had to test

(get-aduser TEMPLATEUSER -properties memberof).memberof | %{add-adgroupmember $_ NEWUSER}