Awesome -thanks Michael.
-Malcolm From: Michael B. Smith [mailto:mich...@smithcons.com] Sent: Monday, September 20, 2010 17:06 To: NT System Admin Issues Subject: RE: PowerShell - pipeline input help Close. get-aduser -filter * -searchbase "OU=Test,OU=User Accounts,DC=fabrikam,DC=com" |% { add-adgroupmember groupname $_.samaccountname } .will do what you want. Regards, Michael B. Smith Consultant and Exchange MVP http://TheEssentialExchange.com From: Malcolm Reitz [mailto:malcolm.re...@live.com] Sent: Monday, September 20, 2010 5:42 PM To: NT System Admin Issues Subject: PowerShell - pipeline input help I'm trying to write a simple PS script to put the membership of an OU in to a security group. I can do this with a bit of code like below, which seems to work fine. $users = get-aduser -filter * -searchbase "OU=Test, OU=User Accounts, DC=fabrikam, DC=com" foreach($user in $users) { add-adgroupmember groupname $user } However, for my PowerShell education, I tried just piping the output of get-aduser in to add-adgroupmember. get-aduser -filter * -searchbase "OU=Test, OU=User Accounts, DC=fabrikam, DC=com" | add-adgroupmember groupname * This fails miserably. I'm guessing I don't have the correct parameter syntax for add-adgroupmember? Can any of our PS pros point me in the right direction for the answer? Thanks, -Malcolm ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ --- To manage subscriptions click here: http://lyris.sunbelt-software.com/read/my_forums/ or send an email to listmana...@lyris.sunbeltsoftware.com with the body: unsubscribe ntsysadmin ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ --- To manage subscriptions click here: http://lyris.sunbelt-software.com/read/my_forums/ or send an email to listmana...@lyris.sunbeltsoftware.com with the body: unsubscribe ntsysadmin