Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Atlanta, Georgia, USA
    Posts
    276
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Help with a PowerShell command

    Hi all. I'm trying to figure out a Powershell command I can use to get me the following information in a csv file. I'm not really proficient in powershell so this is extremely difficult. I'm just trying to find something that some has already used that I can give a try. I've tried this - https://gallery.technet.microsoft.co...e-and-3f408172 - and this - https://gallery.technet.microsoft.co...eport-c805970e - but haven't figured out how to edit them to do what I want or give me what I need. Any ideas? Again, all I need is what you see below for my entire organization. We have an Exchange 2007 server.





  2. #2
    Administrator
    Join Date
    Mar 2001
    Location
    St Louis, Missouri, USA
    Posts
    23,572
    Thanks
    5
    Thanked 1,057 Times in 926 Posts
    There is nothing below.

    Joe

  3. #3
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Atlanta, Georgia, USA
    Posts
    276
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Huh, weird. Here's what's missing:

    DisplayName Company PrimarySmtpAddress Alias TotalItemSize(MB) Full Access Rights SendOnBehalf

  4. #4
    Lounger
    Join Date
    Dec 2009
    Posts
    27
    Thanks
    2
    Thanked 10 Times in 4 Posts
    Here's a modified (and simplified) version of the scripts you linked to. I've included SendAs permissions as well as SendOnBehalfOf. The permissions are given as a list of users separated by spaces. The field delimiter is a semicolon and there are likely to be commas in the TotalItemSize column.

    HTML Code:
    #Specify the csv file name and location 
    $outFile = "E:\info.csv" 
     
    # Prepare output collection 
    $return = @() 
     
    # Loop through Exchange Server Mailboxes 
    $Mailboxes = Get-Mailbox -ResultSize Unlimited -IgnoreDefaultScope -ErrorAction SilentlyContinue 
    ForEach ($Mailbox in $Mailboxes) 
    { 
    
    	$userStatistics = Get-MailboxStatistics $Mailbox.Identity 
     
    	$totalItemSize = if ($userStatistics.TotalItemSize.Value) {$userStatistics.TotalItemSize.Value.ToKB()} 
    
    	$Obj = New-Object PSObject 
    	$Obj | Add-Member NoteProperty -Name "DisplayName" -Value $Mailbox.DisplayName 
    	$Obj | Add-Member NoteProperty -Name "PrimarySmtpAddress" -Value $Mailbox.PrimarySmtpAddress 
    	$Obj | Add-Member NoteProperty -Name "Alias" -Value $Mailbox.Alias
    	$Obj | Add-Member NoteProperty -Name "TotalItemSize(KB)" -Value ("{0:n0}" -f $totalItemSize) 
    
    	$permissions=get-mailboxpermission $Mailbox.Identity
    	#get the permissions
    	$fullacces=""
    	$sendas=""
    	foreach ($p in $permissions)
    	{
    		if ($p.AccessRights -like "*FullAccess*") {$fullaccess += " " + $p.User.RawIdentity}
    		if ($p.AccessRights -like "*SendAs*") {$sendas += " " + $p.User.RawIdentity}
    	}
    	$Obj | Add-Member NoteProperty -Name "FullAccess" -Value $fullaccess
    	$Obj | Add-Member NoteProperty -Name "SendAs" -Value $sendas
    	#get SendOnBehalfOf
    	$sendonbehalf=""
    	foreach($p in $Mailbox.GrantSendonBehalfTo) 
    	{
    		$sendonbehalf += " " + $p.Parent + "/" + $p.Name
    	}
    	$Obj | Add-Member NoteProperty -Name "SendOnBehalfOf" -Value $sendonbehalf
    			 
    	$return += $Obj 
    } 
      
    # Export output to csv 
    $return | Export-Csv -Path $outFile -Delimiter ";" -Force -noTypeInformation -Encoding UTF8
    The time it takes to execute depends on the number of mailboxes you have. You may want to look at some at a time by restricting teh number returned in teh line starting $Mailboxes=
    Last edited by Mr Humbug; 2016-03-22 at 12:10.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •