Solved

Exchange Management Shell

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

Are You Headed to Black Hat USA 2017?

Getting ready for Black Hat next week? Kick things off with the WatchGuard Badge Challenge and test your puzzle and cipher skills. Do you have what it takes to earn our limited edition Firebox Badge? Get started today - https://crimsonthorn.net

Question has a verified solution.

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

A list of top three free exchange EDB viewers that helps the user to extract a mailbox from an unmounted .edb file and get a clear preview of all emails & other items with just a single click on mailboxes.
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
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…
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…
Suggested Courses
Course of the Month11 days, 13 hours left to enroll

623 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