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)
Set objOutputFile = Nothing
Set objFSO = Nothing
MsgBox "Done. Please see output text file."
strMembers = ""
For Each objMember In objGroup.Members
If strMembers = "" Then
strMembers = objMember.Name
strMembers = strMembers & VbCrLf & objMember.FullName
GetMembers = strMembers
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-DistributionGroupMembe
r –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?