Solved

powershell script for exchange

Posted on 2015-02-19
6
126 Views
Last Modified: 2015-02-19
Need some help with this

We use exchange online with office 365 I need to verify that a particular user has fullaccess permission on every mailbox.  I can see what mailboxes he has access to with this:

Get-MailBox | Get-MailboxPermission -User "user@domain.com" | export-csv c:\temp\results.csv

What I need however is the opposite, I need to see what mailboxes he doesn't have access to.

Thanks!
0
Comment
Question by:jcneil4
  • 3
  • 3
6 Comments
 
LVL 68

Expert Comment

by:Qlemo
Comment Utility
This will result in all mailbox objects this particular user does not have access to:
get-mailbox | % { if (Get-MailboxPermission $_ -User user@domain.com) {} else { $_ }}

Open in new window

0
 
LVL 1

Author Comment

by:jcneil4
Comment Utility
Thanks when I run it returns this error for each:

Cannot process argument transformation on parameter 'Identity'. Cannot convert value "smith, Mike" to type
"Microsoft.Exchange.Configuration.Tasks.MailboxIdParameter". Error: "Cannot convert hashtable to an object of the following type:
Microsoft.Exchange.Configuration.Tasks.MailboxIdParameter. Hashtable-to-Object conversion is not supported in restricted language mode or
a Data section."
    + CategoryInfo          : InvalidData: (:) [Get-MailboxPermission], ParameterBindin...mationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-MailboxPermission
    + PSComputerName        : outlook.office365.com
0
 
LVL 68

Expert Comment

by:Qlemo
Comment Utility
Has to be a O365 issue, because it works with my MSX2007.
Let's try by being more specific:
get-mailbox | % { if (Get-MailboxPermission -Identity $_,Identity -User user@domain.com) {} else { $_ }}

Open in new window

0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 1

Author Comment

by:jcneil4
Comment Utility
Actually tried that already!  Doesn't work-

new error:

Cannot process argument transformation on parameter 'Identity'. Cannot convert the "System.Collections.ArrayList" value of type
"System.Collections.ArrayList" to type "Microsoft.Exchange.Configuration.Tasks.MailboxIdParameter".
    + CategoryInfo          : InvalidData: (:) [Get-MailboxPermission], ParameterBindin...mationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-MailboxPermission
    + PSComputerName        : outlook.office365.com
0
 
LVL 68

Accepted Solution

by:
Qlemo earned 500 total points
Comment Utility
Sorry, a typo. Needs to be dot instead of comma ...
get-mailbox | % { if (Get-MailboxPermission -Identity $_.Identity -User user@domain.com) {} else { $_ }}

Open in new window

0
 
LVL 1

Author Comment

by:jcneil4
Comment Utility
You are the man!  Thanks!
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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.
Find out what Office 365 Transport Rules are, how they work and their limitations managing Office 365 signatures.
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…
how to add IIS SMTP to handle application/Scanner relays into office 365.

772 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

12 Experts available now in Live!

Get 1:1 Help Now