Link to home
Start Free TrialLog in
Avatar of jcneil4
jcneil4

asked on

powershell script for exchange

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!
Avatar of Qlemo
Qlemo
Flag of Germany image

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

Avatar of jcneil4
jcneil4

ASKER

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
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

Avatar of jcneil4

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jcneil4

ASKER

You are the man!  Thanks!