Powershell o365 command question

Hello.  I am trying to do a simple powershell command to pull up access rights from a CSV list:

import-csv d:\scripts\accessrightsreport.csv | ForEach {Get-MailboxPermission -identity $_.email | where {$_.AccessRights -eq "FullAccess" -and $_.IsInherited -eq $false}} | Select User,{$_.AccessRights} | Export-CSV d:\scripts\MailboxReports\FullAccessReport.csv

The command seems to run, but at the end, I get:

Cannot process argument transformation on parameter 'Identity'. Cannot convert value "" to type
"Microsoft.Exchange.Configuration.Tasks.MailboxIdParameter". Error: "Parameter values of type
Microsoft.Exchange.Configuration.Tasks.MailboxIdParameter can't be empty. Specify a value, and try again.
Parameter name: identity"
    + CategoryInfo          : InvalidData: (:) [Get-MailboxPermission], ParameterBindin...mationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-MailboxPermission
    + PSComputerName        : outlook.office365.com

Where is the arguement I am leaving out?

March 20th, 2015 3:26pm

What's in accessrightsreport.csv? A few sample lines would be useful.

If you change "ForEach {Get-MailboxPermission" to "ForEach {$_.email; Get-MailboxPermission" you will be able to see if any lines in accessrightsreport.csv are processed before it fails.


Free Windows Admin Tool Kit Click here and download it now
March 20th, 2015 4:51pm

Is there a switch I'm not adding in to allow the write to continue even if it comes to items that are not found?  I didn't have to do that on 2013...

March 20th, 2015 5:09pm

Get-MailboxPermission -identity $_.email -ErrorAction SilentlyContinue
Free Windows Admin Tool Kit Click here and download it now
March 20th, 2015 6:27pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics