Skip to content

Instantly share code, notes, and snippets.

View jdhitsolutions's full-sized avatar

Jeff Hicks jdhitsolutions

View GitHub Profile
jdhitsolutions / PSRefresh.ps1
Last active March 1, 2024 16:33
Refresh a new Windows PowerShell Installation.
View PSRefresh.ps1
#requires -version 5.1
#requires -RunAsAdministrator
Update key PowerShell components on a new Windows 10/11 installation.
This script is not intended for server operating systems. The script
should be run in an interactive console session and not in a remoting session.
jdhitsolutions /
Last active February 28, 2024 04:12
PowerShell Podcast Scripting Challenge

PowerShell Podcast ScriptingChallenge

This is the PowerShell scripting challenge from my appearance on the PowerShell Podcast

Base Challenge

Using whatever tools and techniques you want, write a PowerShell function that will query the Issues section of a GitHub repository and create output showing the number of open issues by label and the percentage of all open issues. Remember that multiple labels may be used with an issue.

For example, if there are 54 open issues and the bug label is used 23 times,your output would show a count of 23 and a total percentage of 42.59 for the bug

jdhitsolutions / 1. PSUGInnSalzach
Last active November 9, 2023 20:21
Presentation material for PSUGInnSalzach 9 Nov 2023
View 1. PSUGInnSalzach
return "This is a demo script file."
#about me
#Module layout
psedit c:\scripts\new-project.ps1
. c:\scripts\new-project.ps1
Help New-PSProject
jdhitsolutions / rtpsug-advparameters.ps1
Created April 6, 2023 03:19
The demonstration file from my presentation for the Research Triangle PowerShell User Group on advanced function parameters.
View rtpsug-advparameters.ps1
#requires -version 7.3
No code in this file should be considered production-ready.
All code and explanations should be viewed as educational material.
You are free to re-use anything in this file in your own work.
jdhitsolutions / Send-MastodonPost.ps1
Created December 21, 2022 20:19
A PowerShell function to post a Mastodon status.
View Send-MastodonPost.ps1
#requires -version 5.1
Based on a function from
You need an access token that has at least write access to your status
* go to settings -> Development
* Click "New Application"
* Enter a name
jdhitsolutions / set-envvar.ps1
Last active November 10, 2023 13:08
Set a temporary environment variable in PowerShell
View set-envvar.ps1
#requires -version 5.1
#set a temporary environment variable
# example using the function alias and positional parameters: se rust_log debug
Function Set-EnvironmentVariable {
Param (
[Parameter(Position = 0, Mandatory)]
jdhitsolutions / ConvertTo-PSClass
Last active November 10, 2023 13:08
A PowerShell function to convert an object instance into a PowerShell class definition.
View ConvertTo-PSClass
Function ConvertTo-PSClass {
[Parameter(Position = 0, Mandatory, ValueFromPipeline)]
[Parameter(Mandatory, HelpMessage = "Enter the name of your new class")]
jdhitsolutions / Get-WinEventReport.ps1
Last active November 10, 2023 13:08
A PowerShell 7 function and custom format file to analyze an event log and report on error sources. Put both files in the same folder. Dot source the ps1 file.
View Get-WinEventReport.ps1
#requires -version 7.2
#requires -module ThreadJob
if ($IsLinux -OR $IsMacOS) {
Return "$($ command requires a Windows platform.$($PSStyle.Reset)"
if ($ -ne "ConsoleHost") {
Return "$($ $($ This command must be run from a PowerShell 7.x console prompt.$($PSStyle.Reset)"
Function Get-WinEventReport {
jdhitsolutions / Get-Status.ps1
Created August 23, 2022 21:41
A demonstration PowerShell 7 function using $PSStyle as default formatting. Put both files in the same folder. Dot source the ps1 file.
View Get-Status.ps1
#requires -version 7.2
Function Get-Status {
[cmdletbinding(DefaultParameterSetName = 'name')]
Position = 0,
jdhitsolutions / Get-HostPrivateData.ps1
Created August 23, 2022 14:58
A PowerShell set of functions for managing host private data
View Get-HostPrivateData.ps1
#requires -version 5.1
#for best results run these commands in a PowerShell console
Function Get-HostPrivateData {