Search code examples
powershellcommand-prompt

Command Prompt: access denied when run PowerShell


I got a problem when try to run powershell from command line. I typed powershell.exe when pop up window shows up in blue background saying: "This app cant run on your PC, to find version for your PC check publisher". Then command prompt gives message: "Access is denied."

Any suggestions would be highly appreciated.


Solution

  • My problem was that C:/windows/system32/powershell.exe was invalid as you can see on the image below:

    enter image description here

    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