pest_control Sympthoms
- When you double click a PowerShell script it opens up in the notepad or in the PowerShell ISE instead of executing
search Causes
- This is expected behavior. This can be changed by following the steps below.
construction Fix/Workaround/Solution
There are several ways to achieve the result, but the following appears to be the easiest one without having to edit registry keys or other system parameters.
- Right click the script you intend to execute
- Select “*Open with...*” and then “Chose another app“
- Flag the option “Always use this app to open .ps1 files” then click on “*More apps*” and finally on “Look for another app on this pc”
- Navigate to the default PowerShell install directory “C:\Windows\System32\WindowsPowerShell\v1.0“
- Select “**powershell.exe**” then “Open”
school Further considerations
If your script doesn’t run when double clicked (it closes without a warning) and you are sure the problem doesn’t lays in the script itself, you might want to have a look into the current setup of the execution policies of your system.
If you need guidance on it, you can follow the steps on “How to check and edit Windows scripts execution policies“.
Article ID: SYS-WIN-0002