Link to home
Create AccountLog in
Avatar of MilesLogan
MilesLoganFlag for United States of America

asked on

Power Shell - Quest - How to pull sAMAccountNames from multiple groups

Hi EE

I have the script below that pulls the info below from the groups I enter in the groups.txt file .. any idea what I need to modify so it also outputs the sAMAccountNames for the group members ?


GC C:\Powershell\Groups.txt | % {
Get-qadgroup $_ | Select GroupName,GrpMembers,AccountIsDisabled,UserDN
Get-Qadgroup $_ | Get-QADGroupMember -Indirect -SizeLimit 0 |
      ? {$_.Type -eq "User"} | Select GroupName,@{N="GrpMembers";E={$_.Name}},AccountIsDisabled,@{N="UserDN";E={$_.DN}}
} | Select-Object GroupName,GrpMembers,AccountIsDisabled,UserDN | ConvertTo-HTML | Out-File C:\Powershell\Test.htm
ASKER CERTIFIED SOLUTION
Avatar of SubSun
SubSun
Flag of India image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of MilesLogan

ASKER

WOW Subsun ! you have helped me out so much !

when will we see the Subsun blog ? if I can help by giving you the url and some space for it let me know .. the least I can do to help

thanks much !
It is so kind of you to say that.. :-)..  I am happy to help!.. Definitely I am planning to start my own blog, but as of now I am flooded with projects and I am just popping in as and when I get time to keep myself updated..