Posted on Leave a comment

Execute ps1 files at command line

1. Open regedit.exe

2. Export copy of the registry

3. Navigate to


4.  Change the default from ‘Open’ to ‘0’

5. Could change default parameters to powershell.exe in HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellCommand

Another option:
3. Navigate in registry to HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellOpenCommand

4. Change Old Value:
“C:WindowsSystem32notepad.exe” “%1”

to New Value:
“C:WindowsSystem32WindowsPowerShellv1.0powershell.exe” -NoLogo -NoProfile -NonInteractive -ExecutionPolicy “Bypass” -File “%1”

Why not do this:

This makes it easy for dangerous .ps1 files to be executed.  With great power comes great responsibility.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.