Announcement

Collapse
No announcement yet.

List all members of all Distro groups, without Exchange addin.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • List all members of all Distro groups, without Exchange addin.

    I have a 2008 server AD server with a 2003 Exchange, and I am attempting to list all the members of all the distro groups, hopfully in something formatted enough to form a report out of.

    I am having problems getting the info without the exchange addon (cant install it yet). I have found a few VB scripts, that use the ADO, but I have little knowledge of VB, so all I can do is run them and hope, and none have worked so far.

    I can not see why I can not just use PS, but I have yet to find a command that will list all the member of all groups without the Exchange add on.

    Anyone have any ideas, as I am almost bald becuse of this.

    Thanks,
    Wofen
    Good to be back....

  • #2
    Re: List all members of all Distro groups, without Exchange addin.

    Hi,

    Can you install questad command lets and then you can use the following script should work.

    save the following file as anyName.ps1
    The way to execute is
    x:>.\anyName.ps1 GroupName
    It accept groupName as parameter
    ################################################## #############################################
    # Get-MyGroupMembersRecursive.ps1 #
    # Created by Hugo Peeters #
    # http://www.peetersonline.nl #
    ###################################

    param($ParentGroupNames)

    $Global:myCol = @()

    function Indent
    {
    param([Int]$Level)
    $Global:Indent = $null
    For ($x = 1 ; $x -le $Level ; $x++)
    {
    $Global:Indent += "`t"
    }
    }

    function Get-MySubGroupMembersRecursive
    {
    param($DNs)
    ForEach ($DN in $DNs)
    {
    $Object = Get-QADObject $DN
    If ($Object.Type -eq "Group")
    {
    $i++
    Indent $i
    Write-Host ("{0}{1}" -f $Indent,$Object.DisplayName) -ForegroundColor "yellow"
    $Group = Get-QADGroup $DN
    If ($Group.Members.Length -ge 1)
    {
    Get-MySubGroupMembersRecursive $Group.Members
    }
    $i--
    Indent $i
    Clear-Variable Group -ErrorAction SilentlyContinue
    }
    Else
    {
    $userfound = Get-QADUser $DN | Select Name, Email
    Write-Host ("{0} {1}" -f $Indent,$userfound.Name)
    $Global:myCol += $userfound
    Clear-Variable userfound -ErrorAction SilentlyContinue
    }
    }
    }

    ForEach ($ParentGroupName in $ParentGroupNames)
    {
    $Global:Indent = $null
    $ParentGroup = Get-QADGroup -Name $ParentGroupName
    Write-Host "====================="
    Write-Host " TREE VIEW PER GROUP"
    Write-Host "====================="
    Write-Host ("{0}" -f $ParentGroup.DisplayName) -ForegroundColor "yellow"
    If ($ParentGroup -eq $null)
    {
    Write-Warning "Group $ParentGroupName not found."
    break
    }
    Else
    {
    $FirstMembers = $ParentGroup.Members
    ForEach ($member in $firstmembers)
    {
    Get-MySubGroupMembersRecursive $member
    }
    }
    }
    Write-Host ""
    Write-Host "====================="
    Write-Host " All Unique Members: "
    Write-Host "====================="
    $myCol | Sort Name | Select Name, Email -Unique
    ################################################## ########
    Thanks & Regards
    v-2nas

    MCTS 2008, MCTIP, MCSE 2003, MCSA+Messaging E2K3, MCP, E2K7
    Sr. Wintel Eng. (Investment Bank)
    Independent IT Consultant and Architect
    Blog: http://www.exchadtech.blogspot.com

    Show your appreciation for my help by giving reputation points

    Comment


    • #3
      Re: List all members of all Distro groups, without Exchange addin.

      Thanks V-2 for the fast reply, I will see about installing quested, but this is a new job, so I dont want to cause too meny ripples by making changes so soon, but I have a feeling that I will have to install something to get the list they want... unless I do it by hand.

      I will do alittle research into Quested, as I need to make sure there are no secruity problems, or that its going to interupt anything else.

      Thanks,
      Wofen
      Good to be back....

      Comment

      Working...
      X