SingAbout Martin
asked on
PowerShell Exchange: Get specific MailboxFolder permission
What I'm trying to do is get an export of all Mailboxes within a specific OU of which the user "Default" has the AccessRights of "Owner". I'm running Exchange 2010 and have the ability to use PowerShell 2.0 (from Windows Server 2008 R2) or PowerShell 4.0 (from Windows Server 2012 R2). I'm running Exchange 2010.
$AllMailbox = Get-Mailbox -OrganizationalUnit "DN of OU" -ResultSize Unlimited ForEach ($Mailbox) in ($AllMailbox) {Get-MailboxFolderPermissi on $Mailbox | Where-Object {$_.User -Match "Default" -AND $_.AccessRights -Match "Owner"} | Select-Object Identity,AccessRights,@{Na me="Name"; Expression={$Mailbox.Name} }} | Export-CSV -Path C:\temp\export.csv
However I'm getting the following error. A valid OrganizationalUnit DN is given.
ForEach-Object : Cannot bind parameter 'RemainingScripts'. Cannot convert the "in" value of type "System.String" to type "System.Management.Automat i on.ScriptBlock". At line:1 char:134 + $AllMailbox = Get-Mailbox -OrganizationalUnit "OU=X,OU=X ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~ + CategoryInfo : InvalidArgument: (:) [ForEach-Object], ParameterBindingException + FullyQualifiedErrorId : CannotConvertArgumentNoMes sage,Micro soft.Power Shell.Comm ands.ForEa chObjectCo mmand
Any suggestions?
$AllMailbox = Get-Mailbox -OrganizationalUnit "DN of OU" -ResultSize Unlimited ForEach ($Mailbox) in ($AllMailbox) {Get-MailboxFolderPermissi
However I'm getting the following error. A valid OrganizationalUnit DN is given.
ForEach-Object : Cannot bind parameter 'RemainingScripts'. Cannot convert the "in" value of type "System.String" to type "System.Management.Automat
Any suggestions?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hence no response from author I am closing this question.
Thanks
Thanks
ASKER