PSWebGUI is a PowerShell module that lets you quickly and easily create web-based graphical interfaces using HTML and Bootstrap. It's perfect for users who want to integrate PowerShell scripts into a simple and functional web interface.
-
Built-in web server: Run a lightweight web server directly from PowerShell.
-
Custom routes: Define web routes (
/) and link them to PowerShell functions or scripts. -
HTML + Bootstrap support: Design attractive, responsive web interfaces effortlessly.
-
GET and POST method support: Easily handle form input via
$_GET[]and$_POST[]. -
Run and display PowerShell scripts: Execute and show output from scripts or cmdlets in a separate window or in the browser.
-
PowerShell must be run as Administrator.
-
PowerShell version 5.1 or higher.
PS> Install-Module -Name PSWebGui- Download the lastest version of the module from this Github repository.
- Extract the content of the ZIP into
C:\Program Files\WindowsPowerShell\Modules
Open PowerShell as an Administrator and run the following command:
PS> Show-PSWebGUI "Hello World!"This should open a new window with the text "Hello World!".
# Routes definition
PS> $routes = @{
"/"={
"<div>
<h1>Menú</h1>
<a href='/showProcesses'><h2>Show Running Processes</h2></a>
<a href='/showServices'><h2>Show Services</h2></a>
</div>"
}
"/showProcesses" = { Get-Process | Select-Object name, cpu | Format-Html }
"/showServices" = {
"<div>
<h1>Services</h1>"
Get-Service | Format-Html
"</div>"
}
}
# Launch the interface
PS> Show-PSWebGui -InputObject $routesA new window should have opened. Or you can open your browser at http://localhost to view the interface.
PS> Show-PSWebGui -InputObject $routes -Port 9090 -Title "Admin Panel"Starts the web server and displays the interface defined by the provided routes.
Common parameters:
-
-InputObject: Defines routes and their associated content. -
-Port: Server port (default is 80). -
-Title: Sets the page title. -
-PublicServer: Makes the server accessible from other devices on the network. -
-Display: Set the behavior of windows: 'NoGUI' to hide the interface, 'NoConsole' to hide the PowerShell console (terminal/command prompt) or 'Systray' to minimize all to the system tray. -
-Icon: Set the icon for both the interface window and in browser favicon.
Visit command documentation for more detailed info
Converts PowerShell output into styled HTML tables or cards using Bootstrap.
PS> Get-Process | Select-Object Name, CPU | Format-Html
<table class='table'>
<thead>
<tr>
<th>Name</th>
<th>CPU</th>
</tr>
</thead>
<tbody>
...
<tr>
<td>msedge</td>
<td>2672,9375</td>
</tr>
<tr>
<td>explorer</td>
<td>402,296875</td>
</tr>
...
</tbody>
</table>Visit command documentation for more detailed info
Hides / show the PowerShell console window (the terminal). Useful for background scripts.
PS> Hide-PSConsole
PS> Show-PSConsolePreviously there was a built-in function within this module designed to show the posibilities and how this module works. This function has now been moved, as a standalone script, to a separate project.