Skip to content

Instantly share code, notes, and snippets.

View jdhitsolutions's full-sized avatar

Jeff Hicks jdhitsolutions

View GitHub Profile
@jdhitsolutions
jdhitsolutions / Get-Restart.ps1
Created May 7, 2021 18:54
A PowerShell function and format file to query the event log using Get-WinEvent for restart related events.
Function Get-Restart {
[cmdletbinding()]
[outputtype("RestartEvent")]
Param(
[Parameter(Position = 0, ValueFromPipeline)]
[ValidateNotNullOrEmpty()]
[Alias("CN")]
[string]$Computername = $env:COMPUTERNAME,
[Parameter(HelpMessage = "Find restart events since this date and time.")]
[ValidateNotNullOrEmpty()]
@jdhitsolutions
jdhitsolutions / Challenge.md
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
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: 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-GPLink.ps1
Created January 18, 2021 16:47
A PowerShell function to list Group Policy links
@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
@jdhitsolutions
jdhitsolutions / Get-PowerShellEngine
Created August 8, 2017 14:04
A PowerShell function to get information about the currently running PowerShell executable. Details are pulled from $PSVersionTable, $Host and the file object.
#Requires -version 4.0
Function Get-PowerShellEngine {
<#
.Synopsis
Get the path to the current PowerShell engine
.Description
Use this command to find the path to the PowerShell executable, or engine that is running your current session. The path for PowerShell 6 is different than previous versions.
The default is to provide the path only. But you can also get detailed information
@jdhitsolutions
jdhitsolutions / Show-Domain.ps1
Created February 15, 2021 15:06
A PowerShell script to display an Active Directory domain in colorized and tree form.
# requires -versoin 5.1
# requires -module ActiveDirectory
Function Show-DomainTree {
[cmdletbinding()]
[OutputType("String")]
[alias("dt")]
Param(
[Parameter(Position = 0, HelpMessage = "Specify the domain name. The default is the user domain.")]
[ValidateNotNullOrEmpty()]
[string]$Name = $env:USERDOMAIN,
@jdhitsolutions
jdhitsolutions / Find-GitRepository.ps1
Last active March 13, 2024 11:53
Use this PowerShell function to find Git repositories in the specified folder. It is assumed that you have the Git command line tools already installed.
Function Find-GitRepository {
<#
.SYNOPSIS
Find Git repositories
.DESCRIPTION
Use this command to find Git repositories in the specified folder. It is assumed that you have the Git command line tools already installed.
.PARAMETER Path
The top level path to search.
@jdhitsolutions
jdhitsolutions / PSRefresh.ps1
Last active March 11, 2024 21:24
Refresh a new Windows PowerShell Installation.
#requires -version 5.1
#requires -RunAsAdministrator
#PSRefresh.ps1
<#
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
jdhitsolutions / my-conference-future.md
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.

Requirements

First, **I