Solved

exchange 2013 powershell

Posted on 2014-09-24
3
263 Views
Last Modified: 2014-09-25
I have this powershell query that finds all distribution or mail enabled security groups  in a OU.  I am dealing with old issues with users who had previous versions of the distribution groups/lists. The problem I found is  I cannot automatically import global security groups into the managedby property. Is there a way to capture if the user field contains a global or universal security group that shows up in the identity field and automatically extract those members to a csv file in the following format.

nameofsecuritygroup        user    nameofdistributiongrouptogointomanagedby
globalsec1                            user1  distlistalaskafolks
globalsec1                            user1  distlistalaskafolks
globalsec2                            user5  distlistchicagofolks


get-distributiongroup -organizationalunit  "OU=marketing,OU=Users,DC=contoso,DC=com" | get-adpermission | where { $_.accessrights -match 'write' -or $_.AccessRights -match 'GenericAll' -and $_.user -notlike '*exchange*' -and $_.user -notlike '*system*' -and $_.user -notlike 's-1*' -and $_.user -notlike '*admins*' -and $_.user -notlike '*organization*' -and $_.user -notlike '*self*' -and $_.user -notlike '*administrators*' } | select identity,user

Open in new window

0
Comment
Question by:techdrive
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 19

Expert Comment

by:Raheman M. Abdul
ID: 40344748
foreach ($group in Get-DistributionGroup) { get-distributiongroupmember $group | ft @{expression={$_.displayname};Label=”$group”} | Out-File c:\temp\DistributionListMembers.txt -append}

Open in new window


Does the result of above is ok for you to proceed further?
0
 
LVL 19

Accepted Solution

by:
Raheman M. Abdul earned 500 total points
ID: 40344769
Try this:
$Objects = @()
$groups = Get-DistributionGroup -ResultSize Unlimited 

       $groups | ForEach-Object { 
             [array]$groupMembers = Get-DistributionGroupMember -id $_     
             for ($i = 0; $i -lt $groupMembers.Count; $i++) {
                    $member = $groupMembers[$i].name
                    $object = New-Object System.Object
		            if ($i -eq 0) 
                    {
                       $object | Add-Member -MemberType NoteProperty -Value $_.Name -Name 'Distribution Group' -Force
                    }
                    $object | Add-Member -MemberType NoteProperty -Value $member -Name 'Members' -Force -PassThru                
                    $Objects += $object
             }
       } 
$Objects | Export-Csv -Encoding 'Unicode' c:\temp\GroupMembers.csv

Open in new window

0
 

Author Comment

by:techdrive
ID: 40344821
sweet thanks
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
This article will help to fix the below errors for MS Exchange Server 2013 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
In this video we show how to create a Shared Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Sha…
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question