Solved

powershell script for exchange

Posted on 2015-02-19
6
141 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
ID: 40619057
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
ID: 40619074
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
ID: 40619128
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
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
LVL 1

Author Comment

by:jcneil4
ID: 40619138
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
ID: 40619181
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
ID: 40619214
You are the man!  Thanks!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…

896 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