1

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

1 Answer 1

2

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
Sign up to request clarification or add additional context in comments.

1 Comment

Works perfectly! I also managed to get this partially working by placing the select-object User, AccessRights within the Foreach-Object loop and then pushing to an Excel file using >> at the end of each loop. This didn't format it very nicely in the excel file as printed headers everytime. Thanks for the help mjolinor!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.