Hidden PowerShell Script Runner
This setup allows you to run PowerShell scripts with the custom .ps9 file extension by simply double-clicking them in File Explorer.
The scripts execute silently (no PowerShell console window appears).
I have a number of powershell scripts that produce tablular reports on how a system is condfigured
I wanted to double click on these powershell scripts and only display the "Out-GridView" window.
- There were many suggestions on the net that did not work.
- Using AI did not work as it was reading incorrect suggestions.
- The assumptions AI was making were truly stunning.
- The way Windows and Microsoft does certain things is also stunning.
- Even the readme it generated perpetuated these error which I fixed manually.
- Double-click any
.ps9file to run it with PowerShell 7 - Completely hidden execution (no flashing black window)
- Uses
ExecutionPolicy Bypassso scripts run without policy restrictions - Clean PowerShell icon for
.ps9files - Works on Windows 10 and Windows 11
You need one file PS9Runner.vbs in a folder of your choosing
I chose D:\Programs\AAA_Scripts\:
-
Make sure PowerShell 7 is installed (recommended: latest LTS version).
-
Place the
PS9Runner.vbsfile inD:\Programs\AAA_Scripts\. -
Double-click the file
PS9Runner.regand click Yes to merge it into the Windows Registry. -
Restart Windows Explorer:
- Open Task Manager → Find Windows Explorer → Click Restart
- I found this step to be redundant
-
Test by double-clicking any
.ps9file. It should run silently.
.ps9files are associated with thePS9ScriptProgID in the Registry- Double-click triggers
wscript.exe→PS9Runner.vbs→ PowerShell 7 - The script content is read and executed via
Invoke-Expression(bypasses the.ps1extension restriction)
- PS9Runner.reg - Registery Entries to associate .ps9 with the hidden helper script
- PS9Runner.vbs - The helper script as suggested options to powershell.exe did not work
- UI-IPCONFIGDATA.ps9 - Example script that display a Gridview window of Network Configuration
- UI-IPCONFIGDATA2.ps9 - Another Example script that display a Gridview window of Network Configuration
- UI-WIFI.ps9 - Example script that display a Gridview window of WIFI SSIDs
- UI-WifiPassword.ps3 - Example script that display a Gridview window of WIFI Passwords
To be continued...