Reputation: 25
I'm trying to get the permission of the calendar folder on a set user, then export it to a CSV, so we can easily view the permissions.
When I run this command:
Get-Mailbox |
Get-MailboxPermission |
Select-Object AccessRights, User, Identity, IsValid |
Export-Csv -Path 'c:\Users\Connor\Desktop'
I get this error:
Export-Csv : Access to the path 'C:\Users\Connor\Desktop' is denied.
At line:1 char:89
+ ... hts,User,Identity,IsValid | Export-Csv -Path 'c:\Users\Connor\Desktop'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (:) [Export-Csv], UnauthorizedAccessException
+ FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.ExportCsvCommand
Upvotes: 2
Views: 3760
Reputation: 30107
You need to make sure the PowerShell has write permission to the folder you're trying to write to. You can do this by
C:\temp\
(plus your filename.csv
)Path.GetTempPath
in PS with [System.IO.Path]::GetTempPath()
See Also: Export-Csv - Access to the path 'C:\export.csv' is denied
Upvotes: 1