Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1093
  • Last Modified:

How export members of one DL that have members across different domains?

I'm trying to export the current members of a DL for a request.  
I have tried the following old bat file but it only pulls the users on the domain of the server I'm on.
'=====================
Set wshNetwork = WScript.CreateObject( "WScript.Network" )
strUserDomain = wshNetwork.UserDomain
strUserComputer = wshNetwork.ComputerName
strUserName = wshNetwork.UserName

strGroup = InputBox("Please type the AD group name to get members of:", "Group Name", "mf_users")
Set objWinntObject = GetObject("WinNT://" & strUserDomain & "/" & strGroup)

strResults = "Results" & VbCrLf & "======="
strResults = strResults & VbCrLf & "Group: " & objWinntObject.Name
strMembers = GetMembers(GetObject("WinNT://" & strUserDomain & "/" & objWinntObject.Name))
strResults = strResults & VbCrLf & strMembers & VbCrLf

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objOutputFile = objFSO.CreateTextFile("DomainGroups.txt", True)
objOutputFile.Write strResults
objOutputFile.Close
Set objOutputFile = Nothing
Set objFSO = Nothing

MsgBox "Done.  Please see output text file."

Function GetMembers(objGroup)      
      strMembers = ""
      
      For Each objMember In objGroup.Members
            If strMembers = "" Then
                  strMembers = objMember.Name
            Else
                  strMembers = strMembers & VbCrLf & objMember.FullName
            End If
      Next
      GetMembers = strMembers
End Function
'=====================

Open in new window


I've tried using the Query search within ADUC looking for the Member of "distinguishedName" but still that query is not pulling all the members. [and I which to the different domains]

I tried this cmd to view the members to see if its displays all the members across all the domains: Get-DistributionGroupMember –identity “group name” | ft name, primarysmtpaddress

But again no...what cmd can I run that will ensure I'm pulling all members into a cvs file for all 3 domains?

Thanks
0
Admin_Stooge
Asked:
Admin_Stooge
  • 7
  • 5
1 Solution
 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
Get-DistributionGroup | Get-DistributionGroupMember | FT Name, *Member* > DL.cvs or txt

- Rancy
0
 
Admin_StoogeAuthor Commented:
So where do I put in the name of the group where I want to export the members?
0
 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
0
A Cyber Security RX to Protect Your Organization

Join us on December 13th for a webinar to learn how medical providers can defend against malware with a cyber security "Rx" that supports a healthy technology adoption plan for every healthcare organization.

 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
Are you trying to Export members of one Distribution List or all ?

- Rancy
0
 
Admin_StoogeAuthor Commented:
Just one DL
0
 
Admin_StoogeAuthor Commented:
This cmd is not pulling all the members across other domains.
Get-DistributionGroupMember –identity “group name” | ft name, primarysmtpaddress > c:\members.csv

It just seems to pull the name of the members of the same domain I'm running the cmd from
0
 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
Get-DistributionGroup -Identity "DL Name" | Get-DistributionGroupMember | FT Name, *Member*

The Get-DistributionGroupMember command does not return all the members of distribution group if there are multiple Active Directory domains in your topology environment
http://support.microsoft.com/kb/975555


- Rancy
0
 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
To resolve this issue, follow these steps:

    Open Exchange Management Shell.
    Type the following command at the command line:
    Set-ADServerSettings -ViewEntireForest $True
    Note The Set-ADServerSettings command is a new command in Exchange Server 2010. By default, the ViewEntireForest parameter is set to False.
    Run the Get-DistributionGroupMember command to retrieve all the members of the distribution group.

- Rancy
0
 
Admin_StoogeAuthor Commented:
Set-ADServerSettings -ViewEntireForest $True is for Exchange 2010 and I get an error when attempting to perform this task against Exchange 2007
0
 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
How to Change the Recipient Scope
http://technet.microsoft.com/en-us/library/bb124791%28v=EXCHG.80%29.aspx

$AdminSessionADSettings
ViewEntireForest (What is this set to ??)


http://exchangeserverpro.com/how-to-modify-recipient-scope-in-the-exchange-management-shell

- Rancy
0
 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
Did that help ..... sorry work a lot with E2k10 so :)

- Rancy
0
 
Admin_StoogeAuthor Commented:
Thanks Rancy...it helped big time.  No reason to be sorry...lol
Thanks again for your insight
0
 
lastcowCommented:
iGnore me.
avator.png
0

Featured Post

New Tabletop Appliances Blow Competitors Away!

WatchGuard’s new T15, T35 and T55 tabletop UTMs provide the highest-performing security inspection in their class, allowing users at small offices, home offices and distributed enterprises to experience blazing-fast Internet speeds without sacrificing enterprise-grade security.

  • 7
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now