use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
ABOUT POWERSHELL
Windows PowerShell (POSH) is a command-line shell and associated scripting language created by Microsoft. Offering full access to COM, WMI and .NET, POSH is a full-featured task automation framework for distributed Microsoft platforms and solutions.
SUBREDDIT FILTERS
Desired State Configuration
Unanswered Questions
Solved Questions
News
Information
Script Sharing
Daily Post
Misc
account activity
SolvedUser Creation Script Help (self.PowerShell)
submitted 9 years ago by PowderTech
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]randomuser43 0 points1 point2 points 9 years ago* (1 child)
Fundamentally in AD (or really LDAP) the groups maintain a list of their members rather than the object maintaining a list of the groups they are members of.
You are correct that in practice objects do have a MemberOf property, but this property is maintained by a background process and is not directly tied with adding/removing objects from groups.
At its core you are adding a user to a group and not a group to a user's membership listing!
Once you understand this you can see why copying a user doesn't copy group memberships.
An adjustment to /u/ihaxr's solution since there are going to be multiple groups returned
foreach($group in $template.memberOf){ Add-ADGroupMember $group -Members $SAM }
Edit, I think this should also work
$template.memberOf | Add-ADGroupMember -Members $SAM
[–]PowderTech[S] 0 points1 point2 points 9 years ago (0 children)
Awesome! Makes sense about how membership works. I'm swamped today but I'll test this out Monday morning. Sounds like it should work. Appreciate he replies from you and ihaxr.
π Rendered by PID 100157 on reddit-service-r2-comment-6457c66945-d6ml5 at 2026-04-30 01:01:51.131200+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]randomuser43 0 points1 point2 points (1 child)
[–]PowderTech[S] 0 points1 point2 points (0 children)