Question

(Updated Title as I wrote it on the fly)

Got very stumped by this so far and relatively new to powershell.

I have the below script:

cd e:

Import-CSV e:\UserList.csv | Foreach-Object {Get-MailboxFolderPermission -Identity "$($_.account):\Kalender" -User Default} 

| select-object User,AccessRights | export-csv AccessList.csv

However whenever I run it I get the Object Type returned for the AccessRights parameter e.g.:

User,"AccessRights"
Default,"System.Collections.ObjectModel.Collection`1[Microsoft.Exchange.Management.StoreTasks.MailboxFolderAccessRight]"
Default,"System.Collections.ObjectModel.Collection`1[Microsoft.Exchange.Management.StoreTasks.MailboxFolderAccessRight]"

Anyone know how I can get the value out as it prints to powershell? e.g.:

User                                                        AccessRights
----                                                        ------------
Default                                                     {AvailabilityOnly}
Was it helpful?

Solution

Not quite sure why it's behaving that way, but this seems to be a usable workaround:

Import-CSV e:\UserList.csv |
 Foreach-Object {
 Get-MailboxFolderPermission -Identity "$($_.account):\Kalender" -User Default
 } | select-object User,@{l='AccessRights';e={$_.AccessRights}} | 
 export-csv AccessList.csv
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top