Register
: :
Login
Home
News
Forums
Scripts
User Groups
Resources
About
Forums
Search
Members
Unanswered
Active Topics
Forums
>
Using PowerShell
>
Exchange Server
Get-DistributionGroupMember from Exchange
Last Post 31 Oct 2011 06:19 AM by
Karl Mitschke
. 5 Replies.
Sort:
Oldest First
Most Recent First
Prev
Next
You are not authorized to post a reply.
Author
Messages
Paul
New Member
Posts:4
26 Oct 2011 04:33 AM
I need to get the members of several distributions groups in Exchange, I use the Get-DistributionGroupMember - identity 'Group Name' but there is no recursive function.
I need help in getting the members of the groups even the nested groups.
markrailton
New Member
Posts:45
26 Oct 2011 04:42 AM
dunno if this will help you but i had to get a list of all user of groups in a specific OU.
script:
$myCol = @()
ForEach ($Group in (Get-QADGroup -SearchRoot “domain.corp/OUname” -SizeLimit 0 -GroupType Security))
{
ForEach ($Member in (Get-QADGroupMember $Group))
{
$myObj = "" | Select Group, Member
$myObj.Group = $Group.Name
$myObj.Member = $Member.Name
$myCol += $myObj
}
}
$myCol | Export-Csv -Path "C:\SGMembers.csv" -NoTypeInformation
i'm sure you can do something similar with distribution groups, i will take a look in a test enviroment.
just change the object type from security to distribution.
markrailton
New Member
Posts:45
26 Oct 2011 05:18 AM
$myCol = @()
ForEach ($Group in (Get-QADGroup -SearchRoot “domain.corp/distribution groups” -SizeLimit 0 -GroupType distribution))
{
ForEach ($Member in (Get-QADGroupMember $Group))
{
$myObj = "" | Select Group, Member
$myObj.Group = $Group.Name
$myObj.Member = $Member.Name
$myCol += $myObj
}
}
$myCol | Export-Csv -Path "C:\DGMembers.csv" -NoTypeInformation
This did the trick for me :D, you will need quest active directory cmdlets.
Paul
New Member
Posts:4
28 Oct 2011 09:37 AM
Thanks, I actually used a similar script utilizing Quests AD PowerShell comandlets, but in this case those wont work, i'm querying the exchange server for distibution groups.
markrailton
New Member
Posts:45
31 Oct 2011 01:41 AM
if you trying to get members of nested groups i'm sure the script above will output the information you need. Like i said change the grouptype to distribution and then you good to go.
Karl Mitschke
Basic Member
Posts:457
31 Oct 2011 06:19 AM
Check out my blog post:
http://unlockpowershell.wordpress.c...cursively/
Karl
http://unlockpowershell.wordpress.com
Co-Author, Windows PowerShell 2.0 Bible
-join("6B61726C6D69747363686B65406D742E6E6574"-split"(?<=\G.{2})",19|%{[char][int]"0x$_"})
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
>
Exchange Server
Active Forums 4.3
Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2