Command Prompt: access denied when run PowerShell
My problem was that C:/windows/system32/powershell.exe
was invalid as you can see on the image below:
I could found the right executable in C:\Windows\System32\WindowsPowerShell\v1.0\
.
So if this is your problem, try the following:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe .\my-script.ps1
Instead of this:
powershell.exe .\my-script.ps1