Skip to content

Instantly share code, notes, and snippets.

View jdhitsolutions's full-sized avatar

Jeff Hicks jdhitsolutions

View GitHub Profile
jdhitsolutions / demo.ps1
Created April 4, 2024 13:35
Material from my RTPSUG presentation on writing better PowerShell code
return "This is a demo script file."
# Find Me:
# 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 / 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
jdhitsolutions /
Last active March 5, 2024 21:08
My public speaking status and requirements

Public Presentations Terms and Conditions

I have been an IT professional for over 30 years. I have been speaking publicly and presenting at conferences for probably 25 years. I have presented to all types of groups, from small user groups to large conferences, literally around the world. As I enter the last part of my IT career, I am re-assessing what role conferences will play, and where I want to devote my energy and financial resources. The truth is, that as much as I enjoy presenting and meeting people, there is always a trade-off between the time and money spent on conferences and the value I get from them.

Beginning in 2024, I have decided to make some hard decisions. If you are involved in a conference or event where I have spoken in the past, this may be of interest to you. The bottom line is that I am now very selective about what events and conferences I will present at. Let's dive into some details, and of course there will be exceptions, which I'll cover in a bit.


First, **I

jdhitsolutions / PSRefresh.ps1
Last active March 11, 2024 21:24
Refresh a new Windows PowerShell Installation.
#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 April 7, 2024 11:39
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
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.
#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.
#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
#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.
Function ConvertTo-PSClass {
[Parameter(Position = 0, Mandatory, ValueFromPipeline)]
[Parameter(Mandatory, HelpMessage = "Enter the name of your new class")]