Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Error received when running a script

$
0
0

Hello everyone

I would like to explain my situation. I'm using a virtual machine with an admin account but since the account I have don't have enough privileges I used my higher privileges account. I have a server where I use the account with higher privileges but I can't use because it doesn't have power shell installed nor I can install it due to business policies.

So i'm using the first virtual and logging in with the account with higher privileges to powershell and I need to do use a script where it will check a folder and all subfolders, and it needs to display the ACLs.

So far I've found this one (i'm not an expert, i'm learning powershell):

dir \\server\share-Recurse | where { $_.PsIsContainer } | % { $path1 = $_.fullname; Get-Acl $_.Fullname | % { $_.access | where { !$_.IsInherited } | Add-Member -MemberType NoteProperty -name "Path" -Value $path1 -passthru }}

and I get this error:

 

Access to the path 'C:\Users\aaesquivel.BMSL.001\output.csv' is denied.

At line:1 char:234

+ dir "\\bcebffps\BREOF"  -Recurse | where { $_.PsIsContainer } | % { $path1 =

$_.fullname; Get-Acl $_.Fullname | % { $_.access | where { !$_.IsInherited } |

Add-Member -MemberType NoteProperty -name "Path" -Value $path1 -passthru }} > <

<<<  output.csv

    + CategoryInfo          : OpenError: (:) [], UnauthorizedAccessException

    + FullyQualifiedErrorId : FileOpenFailure

 

Thanks in advance!


Viewing all articles
Browse latest Browse all 6937

Trending Articles