Solved

Exchange Management Shell

Posted on 2015-01-16
1
193 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article will help you understand what HashTables are and how to use them in PowerShell.
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…

910 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now