Skip to content

Instantly share code, notes, and snippets.

View jdhitsolutions's full-sized avatar

Jeff Hicks jdhitsolutions

View GitHub Profile
@jdhitsolutions
jdhitsolutions / SendTo-Gist.ps1
Last active November 13, 2020 18:06
A PowerShell ISE script to send selected text as a Github gist. This requires my New-GitHubGist function.
#requires -version 4.0
#dot source the script with the New-GitHubGist function
. C:\scripts\New-GitHubGist.ps1
Function SendTo-Gist {
[cmdletbinding()]
Param(
[Parameter(Position = 0)]
[ValidateNotNullorEmpty()]
@jdhitsolutions
jdhitsolutions / Demo-InformationFunctions.ps1
Created January 23, 2017 18:27
Demos of the PowerShell information stream
#requires -version 5.0
Function Test-Me {
[cmdletbinding()]
Param()
Write-Information "Starting $($MyInvocation.MyCommand) " -Tags Process
Write-Information "PSVersion = $($PSVersionTable.PSVersion)" -Tags Meta
Write-Information "OS = $((Get-CimInstance Win32_operatingsystem).Caption)" -Tags Meta
@jdhitsolutions
jdhitsolutions / New-GithubGist.ps1
Last active March 16, 2023 11:53
A PowerShell script to create a new gist on Github.
#requires -version 4.0
Function New-GitHubGist {
[cmdletbinding(SupportsShouldProcess,DefaultParameterSetName = "Content")]
Param(
[Parameter(Position = 0, Mandatory, HelpMessage = "What is the name for your gist?",ValueFromPipelineByPropertyName)]
[ValidateNotNullorEmpty()]
[string]$Name,
@jdhitsolutions
jdhitsolutions / BoxPrompt.ps1
Last active November 4, 2022 11:31
A fancy PowerShell prompt function that should work cross-platform. See script comments for more information.
#requires -version 5.1
<#
Create a lined box with user and location information. The line color will indicate if the user is running elevated.
The prompt will also display the current date and time and a PS prompt with the PowerShell version.
┌─────────────────────────┐
│ [BOVINE320\Jeff] D:\iso │
└─────────────────────────┘
[01/18/2019 09:30:53] PS v6.1.2>
@jdhitsolutions
jdhitsolutions / myBook.ps1
Created January 26, 2017 15:33
demo PowerShell class script
Enum BookCategory {
GeneralFiction
Horror
Romance
Literary
Mystery
Thriller
ScienceFiction
NonFiction
@jdhitsolutions
jdhitsolutions / Get-PlanetPowerShellFeed.ps1
Created February 9, 2017 14:33
A PowerShell script to get the RSS feed from Planet PowerShell.
#requires -version 4.0
<#
get current entries in the PlanetPowerShell RSS feed
Because of the way entries are syndicated not every feed item
will parse cleanly or with information.
#>
[cmdletbinding()]
Param()
@jdhitsolutions
jdhitsolutions / Check-ModuleUpdate.ps1
Last active May 30, 2023 11:17
Test installed PowerShell modules against online versions in the PowerShell Gallery.
[cmdletbinding()]
[outputtype("moduleInfo")]
Param(
[Parameter(Position = 0, HelpMessage = "Enter a module name or names. Wildcards are allowed.")]
[ValidateNotNullorEmpty()]
[string[]]$Name = "*"
)
Write-Verbose "Getting installed modules"
Try {
@jdhitsolutions
jdhitsolutions / Add-Border.ps1
Last active March 10, 2022 02:41
Insert a text-based border around a string in PowerShell
#add a border around a string of text
Function Add-Border {
<#
.Synopsis
Create a text border around a string.
.Description
This command will create a character or text based border around a line of text. You might use this to create a formatted text report or to improve the display of information to the screen.
@jdhitsolutions
jdhitsolutions / Get-CimNamespace.ps1
Created May 5, 2017 12:28
A PowerShell function to enumerate WMI namespaces using the CIM cmdlets
#requires -version 4.0
Function Get-CimNamespace {
[cmdletbinding(DefaultParameterSetName = 'computer')]
Param(
[Parameter(Position=0)]
[ValidateNotNullorEmpty()]
[string]$Namespace = "Root",
[Parameter(ParameterSetName = 'computer')]
[ValidateNotNullorEmpty()]
@jdhitsolutions
jdhitsolutions / Download-ToddKlindt.ps1
Created May 15, 2017 18:50
A PowerShell script to download video podcasts from Todd Klindt
#Requires -version 4.0
<#
This is a script but it supports -Whatif and accepts parameters.
#>
[cmdletbinding(SupportsShouldProcess)]
Param (
[Parameter(Position = 0, HelpMessage = "Enter the path where you want to save the downloads")]