With PowerShell, I want to make an export of all the mailboxes in an Exchange environment of users in a specific OU where the level of AccessRights of the user "Default" on the folder level does not equal "None". For this I am using the following command:
$AllMailbox = Get-Mailbox -OrganizationalUnit "DNofOU" -ResultSize Unlimited
$ResultData = foreach ($Mailbox in $AllMailbox)
{
Get-MailboxFolderPermission $Mailbox | Where-Object {$_.User -Match "Default" -AND $_.AccessRights -NotMatch "None"} | Select-Object Identity,AccessRights,@{Name="Name"; Expression={$Mailbox.Name}}
}
$ResultData | Export-CSV -Path C:\temp\MailboxFolderPermissions.csv
However, when running this command I get the following error:
Cannot process argument transformation on parameter 'Identity'. Cannot convert the "DisplayNameOfMailbox" value of type "Deserialized.Microsoft.Exc hange.Data.Directory.Management.Mailbox" to type "Microsoft.Exchange.Configuration.Tasks.MailboxFolderIdParameter". + CategoryInfo : InvalidData: (:) [Get-MailboxFolderPermission], ParameterBindin...mationException + FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-MailboxFolderPermission + PSComputerName : FQDNofExchangeServer
The environment is based on Exchange 2010 on a Windows Server 2008 R2 server with PowerShell version 2.0. It is also possible to execute this from a Windows Server 2012 R2 server with PowerShell version 4.0 when remote connecting to the Exchange server.