Skip to content

Instantly share code, notes, and snippets.

@jdhitsolutions
Last active February 12, 2026 21:16
Show Gist options
  • Select an option

  • Save jdhitsolutions/45e090ff61878a57eb466844a864bd12 to your computer and use it in GitHub Desktop.

Select an option

Save jdhitsolutions/45e090ff61878a57eb466844a864bd12 to your computer and use it in GitHub Desktop.
A PowerShell script that uses the pwshSpectreConsole module to display formatted system information.

Show-SpectreSystemStatus

The PowerShell function in this gist is designed to display the system status of a Windows machine. It provides information about the operating system, hardware, and other relevant details. The function can be used to quickly gather and display important system information in a user-friendly format. This function requires PowerShell 7 and a Windows platform.

Usage

Save all files to the same directory. Dot source the ps1 file.

. .\Show-SystemStatus.ps1

Then you can call the function:

PS C:\> Show-SpectreSystemStatus

Or use the aliases sss or SysStat:

PS C:\> sss

You can connect to a remote computer using traditional PowerShell remoting by specifying a computername and credentials:

PS C:\> Show-SpectreSystemStatus -ComputerName "ThinkX1-JH"

Styles

Formatting is done using the pwshSpectreConsole PowerShell module, which you can install from the PowerShell Gallery. Color styles are defined in the psd1 configuration file. You can modify the color options to your liking by editing the psd1 file. Run Get-SpectreDemoColors to see the available color options.

Make sure this file is in the same directory as the ps1 file.

Files in this gist have been named for ordering and display purposes.

#requires -version 7.5
#requires -Modules pwshSpectreConsole,CimCmdlets
<#
Show-SystemStatus.ps1
Last Updated: Thursday, February 12, 2026
An earlier version of this function was first published at:
https://buttondown.com/behind-the-powershell-pipeline/archive/more-formatting-fun-with-pwshspectreconsole/
#>
Function Show-SpectreSystemStatus {
[cmdletbinding()]
[OutputType('Spectre.Console.Panel')]
[Alias("sss","SysStat")]
Param(
[Parameter(Position=0)]
[ValidateNotNullOrEmpty()]
[Alias("CN")]
[string]$Computername,
[Parameter(Position=1)]
[ValidateNotNullOrEmpty()]
[Alias("RunAs")]
[PSCredential]$Credential,
[Parameter(HelpMessage= "Specify a logo image")]
[ValidateScript({Test-Path $_})]
[ValidateNotNullOrEmpty()]
[string]$Logo = "$PSScriptRoot\MsPowerShell.png"
)
#define a version number for this stand-alone function
$ver = "1.5.1"
#define style variables up front for easy editing
#styles are stored in a default external data file
if (Test-Path $PSScriptRoot\SystemStatusStyle.psd1) {
$styles = Import-PowerShellDataFile $PSScriptRoot\SystemStatusStyle.psd1
#define style variables from the hashtable
$styles.GetEnumerator().Foreach({Set-Variable -name $_.key -Value $_.Value -scope Script })
}
else {
#use defaults
$statusPanel = "default" #Gold1
$linkStyle = "default italic" # "chartreuse1 italic"
$runStyle = "default" #"yellow2"
$processStyle = "default" #"yellow3"
$physicalStyle = "default" #"orange1"
$osStyle = "default bold" #"Thistle1 bold"
$usedStyle = "default" #"OrangeRed1"
$freeStyle = "default" #"GreenYellow"
}
If ($PSBoundParameters.ContainsKey("ComputerName")) {
#remove Logo if passed as a bound parameter and using remoting
($PSBoundParameters.ContainsKey("Logo")) ? $([void]$PSBoundParameters.Remove("Logo")) : $null
#create a CIM session if a computername is passed
Try {
$cimSess = New-CimSession @PSBoundParameters -ErrorAction Stop
}
Catch {
Throw $_
}
}
else {
#use the local host
$Computername = $env:COMPUTERNAME
$cimSess = $Computername
}
#get the data
$cDrive = Get-CimInstance Win32_LogicalDisk -Property Size,Freespace -filter "DeviceID='C:'" -CimSession $cimSess
$os = Get-CimInstance Win32_OperatingSystem -property FreePhysicalMemory,TotalVisibleMemorySize,LastBootUpTime,Caption,OSArchitecture -CimSession $cimSess
$svc = Get-CimInstance Win32_Service -filter "State='Running'" -Property Name -CimSession $cimSess
$cs = Get-CimInstance Win32_ComputerSystem -Property SystemFamily,Manufacturer,Model -CimSession $cimSess
$proc = Get-CimInstance Win32_Process -Property ProcessID,Name,WorkingSetSize,CreationDate -CimSession $cimSess
#assuming this is being run in Windows Terminal or a host that supports links
$link = Write-SpectreHost "[$linkStyle link=https://jdhitsolutions.com/yourls/newsletter]Ctrl+Click here to expand your PowerShell skills[/]" -PassThru |
Format-SpectrePadded -Top 1 -left 1 -Bottom 0 -Right 0
$padParams = @{
Left = 20
Top = 1
Bottom = 0
Right = 0
}
<#
logo path needs to be a file system path
There is a bug in the current version of pwshSpectreConsole that fails if the image path
is a PSDrive, so I'm converting the path to its FileSystem equivalent
#>
$logoImage = Get-SpectreImage (Convert-Path $Logo) -MaxWidth 10 | Format-SpectrePadded @padParams
if ($cimSess.ComputerName) {
Remove-CimSession $cimSess
}
#process the data and create chart elements
$driveData = @(
(New-SpectreChartItem -Label Used -Value $([math]::Round(($cDrive.size - $cDrive.FreeSpace)/1gb,2)) -Color $usedStyle),
(New-SpectreChartItem -Label Free -Value ([math]::Round(($cDrive.FreeSpace)/1gb,2)) -Color $freeStyle)
)
$cLabel = "Disk Usage C: (GB)" | Format-SpectrePadded -Padding 1
$memData = @(
(New-SpectreChartItem -Label Used -Value $([math]::Round(($os.TotalVisibleMemorySize - $os.FreePhysicalMemory)/1mb,2)) -Color $usedStyle),
(New-SpectreChartItem -Label Free -Value ([math]::Round(($os.FreePhysicalMemory)/1mb,2)) -Color $freeStyle)
)
$memLabel = "Memory Usage (GB)" | Format-SpectrePadded -Padding 1
$g1 = $cLabel,($driveData | Format-SpectreBreakdownChart -Width 45) | Format-SpectreGrid
$g2 = $memLabel,($memData | Format-SpectreBreakdownChart -Width 45) | Format-SpectreGrid
$physPanel = $g1,$g2 | Format-SpectreRows | Format-SpectreColumns |
Format-SpectrePanel -Color $physicalStyle -Title "Physical Information :computer_disk:"
$uptime = "{0:dd\.hh\:mm\:ss}" -f (New-TimeSpan -start $os.LastBootUpTime -end (Get-Date))
$hardware = $cs.SystemFamily ? $cs.SystemFamily : "$($cs.Manufacturer): $($cs.Model)"
$cap = Write-SpectreHost "[$osStyle]$($os.Caption)`n$($hardware)`n$($os.OSArchitecture)[/]" -PassThru |
Format-SpectrePadded -padding 1
$physInfo = $physPanel | Format-SpectreRows
$procTable = $proc | Sort WorkingSetSize -Descending |
Select-Object -first 5 -Property @{Name = "ID";Expression = {$_.ProcessID}},
Name,
@{Name="Runtime";Expression = { "{0:dd\.hh\:mm\:ss}" -f (New-TimeSpan -start $_.CreationDate -end (Get-Date))}},
@{Name="WS(M)";Expression = {[int32]($_.WorkingSetSize/1mb) }} |
Format-SpectreTable -Title ":gear: Top 5 Processes" -Color $processStyle -HeaderColor $processStyle
$runGrid = Format-SpectreGrid -Data @(
@("Running Processes:",$proc.Count),
@("Running Services :",$svc.Count),
@("System Uptime :",$upTime)
) | Format-SpectrePadded -Padding .85 |
Format-SpectrePanel -Color $runStyle -title " Run Information :wrench: "
$runInfo = @($cap,$runGrid,$procTable) | ForEach-Object {$_ | New-SpectreGridRow} |
Format-SpectreGrid | Format-SpectrePanel -Border none
$pi = $physInfo,$link,$logoImage | ForEach-Object {$_ | New-SpectreGridRow} |
Format-SpectreGrid
#create the output panel
$runInfo,$pi | Format-SpectreColumns -Padding 1 |
Format-SpectrePadded -Padding .5 |
Format-SpectrePanel -Title " :information: [italic $statusPanel]$($Computername.ToUpper()): System Status v.$ver[/]" -Color $statusPanel
} #end function
@{
statusPanel = 'Wheat1'
linkStyle = 'chartreuse1 italic'
runStyle = 'yellow2'
processStyle = 'yellow3'
physicalStyle = 'orange1'
osStyle = 'Thistle1 bold'
usedStyle = 'OrangeRed1'
freeStyle = 'GreenYellow'
}
MIT License
Copyright (c) 2026 JDH Information Technology Solutions, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
@jdhitsolutions
Copy link
Author

image

@jdhitsolutions
Copy link
Author

Depending on the length of process names, you might a vertical display.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment