I’m encountering an issue when running a line of code in PowerShell from a user with only read permissions. The line in question is as follows:
New-GcsObject -Bucket "$Bucket" -ObjectNamePrefix "ATTACHMENTS" -Folder $AttachmentsPath -Force #| Out-Null
When I execute this command from a PowerShell session as an administrator, it works perfectly. However, when I try to execute it from a user with limited permissions (read-only), I get the following error:
New-GcsObject : Access to the path 'D:TEMPBACKUPSAttachmentsemptyattachments.txt' is denied.
At line:49 char:1
+ New-GcsObject -Bucket "$Bucket" -ObjectNamePrefix "ATTACHMENTS" -Fold ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-GcsObject], UnauthorizedAccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException,Google.PowerShell.CloudStorage.NewGcsObjectCmdlet
It’s worth noting that the path ‘D:TEMPBACKUPSAttachments’ exists and the user has read permissions on it.
Has anyone faced a similar issue before? Any help or suggestions on how to resolve this permissions issue would be greatly appreciated. Thanks in advance!
I tried everything, can u help me? Thx
Iñaki Martinez Ludueña is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.