Skip to content

Instantly share code, notes, and snippets.

View jdhitsolutions's full-sized avatar

Jeff Hicks jdhitsolutions

View GitHub Profile
@jdhitsolutions
jdhitsolutions / .Show-SpectreSystemStatus.md
Last active February 12, 2026 21:16
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
@jdhitsolutions
jdhitsolutions / 1-locationlist.ps1
Last active February 12, 2026 21:18
Save and jump to recently used locations in PowerShell.
#requires -version 7.5
#TODO : Turn this into a module
Class SavedLocation {
[Int32]$Index = $global:LocationList.count + 1
[string]$Path = $($PWD.Path)
[DateTime]$Date = $(Get-Date)
[string]$Provider = (Get-Location).Provider.Name
}
@jdhitsolutions
jdhitsolutions / Out-SelectFile.ps1
Last active December 1, 2025 22:04
Select files from a list generated by the pwshSpectreConsole module.
#requires -version 7.5
#requires -module pwshSpectreConsole
Function Out-SelectFile {
<#
.SYNOPSIS
Select files from a SpectreConsole list
.DESCRIPTION
Select files using Read-SpectreMultiSelection from the pwshSpectreConsole module. Selected objects will be written to the pipeline.
@jdhitsolutions
jdhitsolutions / Import-LocalModule.ps1
Last active December 1, 2025 21:54
Import a local module from a list. Requires PowerShell 7 and the pwshSpectreConsole module.
#requires -version 7.5
#requires -module pwshSpectreConsole
Function Import-LocalModule {
[cmdletbinding()]
[alias('ilm')]
Param(
[Parameter(Position = 0, HelpMessage = "The path to the module data JSON file")]
[ValidateScript({Test-Path $_})]
[string]$DataPath = "c:\scripts\LocalModuleData.json",
[switch]$Passthru
@jdhitsolutions
jdhitsolutions / Select-ToDelete.ps1
Last active December 1, 2025 21:55
Select files to delete in PowerShell. This requires the pwshSpectreConsole PowerShell module and PowerShell 7.
Empty File#requires -version 7.5
#requires -module pwshSpectreConsole
Function Select-ToDelete {
<#
.SYNOPSIS
Select files to delete.
.DESCRIPTION
Pipe files to this command which will use SpectreConsole to present a choice menu. The command has an automatic timeout of 15 seconds.
.PARAMETER InputObject
@jdhitsolutions
jdhitsolutions / Compare-File.ps1
Last active November 21, 2025 18:05
A PowerShell script alternative to Compare-Object for comparing text files. This should be considered a proof-of-concept.
#requires -version 7.2
<#
this is a variation of what you could do comparing text files
using Compare-Object. The only difference really is how this
script formats the output.
This should be considered a PROOF-OF-CONCEPT
#>
@jdhitsolutions
jdhitsolutions / History.format.ps1xml
Last active November 19, 2024 17:19
A custom PowerShell view for history items. This requires PowerShell 7.
<!--
history.format.ps1xml
Format type data generated 11/19/2024 11:19:23 by PROSPERO\Jeff
This file was created using the New-PSFormatXML command that is part
of the PSScriptTools module.
https://github.com/jdhitsolutions/PSScriptTools
To use, import this file into your PowerSHell 7 session:
@jdhitsolutions
jdhitsolutions / Crescendo-Demo.ps1
Created May 8, 2024 20:13
A demonstration PowerShell script using the Crescendo commands to create a PowerShell module.
#requires -version 7.4
#requires -Module Microsoft.PowerShell.Crescendo
#this demo assumes you have copied the du.exe utility from Sysinternals to a folder in your path
#the name of the module to create
$ModuleName = "FolderUsage"
#the parent folder for the module
$ModulePath = "C:\temp"
@jdhitsolutions
jdhitsolutions / demo.ps1
Last active December 10, 2024 15:41
Material from my RTPSUG presentation on writing better PowerShell code
return "This is a demo script file."
# Find Me: https://jdhitsolutions.github.io
# Any one can learn syntax and mechanics.
# Let's focus on the squishy bits - what you should write
# and what not to write
#region Essential rules
@jdhitsolutions
jdhitsolutions / Get-GHIssueStats.ps1
Created March 7, 2024 17:59
My solution for the PowerShell Podcast scripting challenge to write PowerShell code to get GitHub issue statistics.
#requires -version 7.4
<#
This function requires the gh.exe command line tool.
You many encounter API rate restrictions under heavy use.
#>
#load the custom formatting file
Update-FormatData $PSScriptRoot\ghLabelStatus.format.ps1xml