Solved

Exchange Management Shell

Posted on 2015-01-16
1
200 Views
Last Modified: 2015-01-16
I'm trying to export a list of mailboxes that a particular user has full manage access to. I'm trying to export this information to a csv file. The csv file is created but there is not information in the file.  If I run the cmd without the export-csv c:\name.csv then the information is populated to the screen of the shell, which is fine but I need this info in the csv. See below for the script I run. Any help would be great.

$mailboxes = Get-Mailbox -ResultSize Unlimited
foreach ($mailbox in $mailboxes){
Get-MailboxPermission -Identity $mailbox.Alias -User "username" | fl identity, AccessRights
}

The above script populates the shell screen just fine,  but if I run the following:
$mailboxes = Get-Mailbox -ResultSize Unlimited
foreach ($mailbox in $mailboxes){
Get-MailboxPermission -Identity $mailbox.Alias -User "username" | fl identity, AccessRights | export-csv c:\name.csv
}

Or if I change it to :
$mailboxes = Get-Mailbox -ResultSize Unlimited
foreach ($mailbox in $mailboxes){
Get-MailboxPermission -Identity $mailbox.Alias -User "username" | select identity, AccessRights | export-csv c:\name.csv
}
On the above I tried select and select-object and neither populates the csv file even though it creates it. Any idea how I can make this work and thanks in advance.
0
Comment
Question by:timgreen7077
1 Comment
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
ID: 40554739
You should exclude the format-list, and just use export-csv.
Try this:
$mailboxes = Get-Mailbox -ResultSize Unlimited
foreach ($mailbox in $mailboxes){
  $perms += @(Get-MailboxPermission -Identity $mailbox.Alias -User "username")
}
$perms | select identity, accessrights | export-csv c:\name.csv
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
In this video we show how to create an email address policy 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 Mail Flow…
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…

821 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