Solved

Exchange Management Shell

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Synchronize a new Active Directory domain with an existing Office 365 tenant
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
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…
In this video we show how to create a mailbox database 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 Servers >> Data…

743 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

11 Experts available now in Live!

Get 1:1 Help Now