Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1582
  • Last Modified:

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?
0
Adam Brown
Asked:
Adam Brown
  • 2
1 Solution
 
KenMcFCommented:
you can do this with quest if you want to use their cmdlets.

get-qadmemberof TEMPLATEACCOUNT | %{add-qadgroupmember $_ NEWUSERNAME}
0
 
Adam BrownSr Solutions ArchitectAuthor Commented:
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...
0
 
KenMcFCommented:
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}
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now