Skip to content

Instantly share code, notes, and snippets.

View jdhitsolutions's full-sized avatar

Jeff Hicks jdhitsolutions

View GitHub Profile
@jdhitsolutions
jdhitsolutions / License.txt
Last active February 6, 2026 21:20
A PowerShell script that uses the pwshSpectreConsole module to display formatted system information.
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
@jdhitsolutions
jdhitsolutions / license.txt
Last active December 1, 2025 22:32
Save and jump to recently used locations in PowerShell.
MIT License
Copyright (c) 2025 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
@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