Register
: :
Login
Home
News
Forums
Scripts
User Groups
Resources
About
Forums
Search
Members
Unanswered
Active Topics
Forums
>
Using PowerShell
>
Active Directory
Pipe get-qaduser to get-qadmemberof
Last Post 07 Jul 2011 11:12 PM by
gdf1903
. 2 Replies.
Sort:
Oldest First
Most Recent First
Prev
Next
You are not authorized to post a reply.
Author
Messages
gdf1903
New Member
Posts:15
06 Jul 2011 08:36 AM
Hi,
Hopefully someone can point me in the right direction. I'm trying to query AD for all users and the groups that user is a member of, and export the data to a CSV file.
I can export the users:
$FilePath = "output.csv"
$OuDomain = "DC=DOMAIN, DC=local"
Get-QADUser -searchRoot $OuDomain -SizeLimit 0 `
| select-Object dn, sAMAccountName ` | Export-Csv $FilePath
How would I add a get-qadmemberof to this? I tried placing it after the select-object but get an error.
Thanks.
Jonathan
Basic Member
Posts:109
06 Jul 2011 10:25 AM
I am not sure this is the exact format you want, and it will be difficult to get this readable in a CSV file, but try this...
Get-QADUser -searchRoot $OuDomain -SizeLimit 0 | Select-Object dn, sAMAccountName, @{Name="Groups";Expression={(Get-QADMemberOf $_ | Select-Object -expandProperty Name) -join ";"}} | export-csv $FilePath
This will concatenate all your group names separated by ";".
Jonathan Tyler
http://powershellreflections.wordpress.com
Follow Me On Twitter
gdf1903
New Member
Posts:15
07 Jul 2011 11:12 PM
Thanks a lot Jonathan, pretty much exactly what I wanted. Much appreciated!
You are not authorized to post a reply.
Using PowerShell
--General PowerShell
--Active Directory
--Exchange Server
--Lync Server
--SharePoint
--SQL Server
--System Center
--Non-Microsoft Products
--Books, Tools, and Videos
--Working with .NET
--Peer Review
--Testing, Testing...
PowerShell Development
--Cmdlet Development
--PSDrive Provider Development
--Hosting the Shell
Looking Ahead
--Using PowerShell v2.0
--Developing for PowerShell v2.0
PowerShellCommunity.org
--Community Announcements and Assistance
--Completely Unrelated
--User Groups
--Community Business
----Suggestion Box
Forums
>
Using PowerShell
>
Active Directory
Active Forums 4.3
Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2