This topic contains 5 replies, has 2 voices, and was last updated by
May 8, 2015 at 6:44 am #25046
Why am I getting and access denied? I must not be able to see the forest through the trees.
PS C:\utils\scripts\powershell\module2> cat .\1Var.ps1
cat : Access to the path 'C:\utils\scripts\powershell\module2\1Var.ps1' is denied.
At line:1 char:1
+ cat .\1Var.ps1
+ CategoryInfo : PermissionDenied: (C:\utils\script...odule2\1Var.ps1:String) [Get-Content], UnauthorizedAccessException
+ FullyQualifiedErrorId : GetContentReaderUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetContentCommand
PS C:\utils\scripts\powershell\module2> get-acl .\1Var.ps1
Path Owner Access
—- —– ——
1Var.ps myDomain\me mydomain\me Allow FullControl...
May 9, 2015 at 2:29 am #25052ParticipantPoints: 0Rank: Member
Can you run the script?
Have you tried opening the script in ISE?
Is there anything odd in the security settings for the script – open properties in file explorer
May 11, 2015 at 7:04 am #25089
I cannot run the script or open it in ISE. I had to unblock the script but I don't see anything odd in security. I gave myself full access to the entire directory it is in.
May 12, 2015 at 8:32 am #25128ParticipantPoints: 0Rank: Member
Can you open the script in notepad? Is it actually PowerShell code?
May 13, 2015 at 4:56 am #25152
It is powershell code. i can open it in notepad but not in ISE.
May 13, 2015 at 5:34 am #25156
Solution found. it wasn't until I looked at the files in windows explorer that I saw an issue. The file and folder names were green. I removed the "Encrypt contents to secure data" in the advanced properties. I am not sure how that happened but they were zipped up from an instructor. Now everything works as expected.
The topic ‘Access Denied trying to cat a script?’ is closed to new replies.