Skip to content

Instantly share code, notes, and snippets.

View jdhitsolutions's full-sized avatar

Jeff Hicks jdhitsolutions

View GitHub Profile
@jdhitsolutions
jdhitsolutions / ChristmasWishes.ps1
Created December 24, 2015 15:49
Display a colorful and randomly selected Christmas message.
<#
Display a randomly selected holiday quote in a festive color scheme
you can find more Christmas quotes at
http://www.brainyquote.com/quotes/topics/topic_christmas.html
Learn more about PowerShell:
http://jdhitsolutions.com/blog/essential-powershell-resources/
#>
@jdhitsolutions
jdhitsolutions / Get-Confetti.ps1
Created December 30, 2015 14:46
A New Year's Countdown script
#this must be run in the PowerShell console NOT the ISE
if ($host.name -ne 'ConsoleHost') {
Write-Warning "Sorry. This must be run in the PowerShell console."
#bail out
Return
}
#get window dimensions
$X = $host.ui.RawUI.WindowSize.width
@jdhitsolutions
jdhitsolutions / StPatPrompt.ps1
Last active March 17, 2016 15:17
A St. Patrick's Day themed PowerShell Prompt
#edited for clarity.
function prompt {
$message = "$([char]9827) Éirinn go Brách $([char]9827) "
write-host $message -ForegroundColor green -NoNewline
"$((Get-Location).Path)>"
}
@jdhitsolutions
jdhitsolutions / Update-OLWLinkGlossary
Last active March 29, 2016 12:26
A PowerShell function to update and add automatic links to Open Live Writer.
Function Update-OLWLinkGlossary {
<#
.Synopsis
Update Open Live Writer Automatic Links
.Description
This command is designed to make it easier to update and add automatic links to Open Live Writer. It has primarily been written to make it easier to create automatic links for PowerShell commands but you should be able to use it for other items as well.
The command will try to find a matching entry by the Text and if found, will update with the specified values. Be aware that the text you use is case sensitive. Otherwise, the command will create a new entry.
@jdhitsolutions
jdhitsolutions / Set-ISELocation.ps1
Last active June 6, 2016 16:52
Use this PowerShell function in the PowerShell ISE to change location to the directory of the currently selected file.
#requires -version 4.0
#requires -module ISE
<#
use this function in the PowerShell ISE to change location
to the directory of the currently selected file.
Learn more about PowerShell:
http://jdhitsolutions.com/blog/essential-powershell-resources/
#>
@jdhitsolutions
jdhitsolutions / Add-ISESelectLineShortcut.ps1
Last active June 8, 2016 18:24
Add a menu shortcut to the PowerShell ISE to select the current line.
#add an ISE shortcut to select the current line
#put this in your ISE profile script
<#
Microsoft.PowerShell.Host.ISE.ISEMenuItem Add(
string displayName,
scriptblock action,
System.Windows.Input.KeyGesture shortcut
)
#requires -version 3.0
<#
This command will attempt to execute a very simple scriptblock remotely using Invoke-Command. If the command fails
then PowerShell remoting is not properly enabled or configured.
#>
Function Test-PSRemoting {
[cmdletbinding()]
Param(
@jdhitsolutions
jdhitsolutions / Show-GitTip.ps1
Created June 24, 2016 13:10
A PowerShell script to display a random Git tip of the day.
#requires -version 4.0
<#
Display a random Git tip of the day to the console.
This script does not write anything to the pipeline.
You will need to clone or download the git-tips project locally
from https://github.com/git-tips
This script is described at http://bit.ly/1OgpK7O
@jdhitsolutions
jdhitsolutions / Get-EventLogFile.ps1
Created June 17, 2016 12:53
This PowerShell function will use the CIM cmdlets to gather information about classic style event log files.
#requires -version 3.0
Function Get-EventLogFile {
<#
.SYNOPSIS
Get information about classic event logs
.DESCRIPTION
This command will use the CIM cmdlets to gather information about event log files. The default is to display all classic style event logs or you can select a specific one by name.
@jdhitsolutions
jdhitsolutions / Get-ISEMru.ps1
Created December 6, 2016 15:18
A PowerShell function to get the most recent used list. Note that this list isn't updated until you close the ISE.
Function Get-ISEMRU {
[cmdletbinding()]
Param()
<#
Path will be something like:
C:\Users\Jeff\AppData\Local\microsoft_corporation\powershell_ise.exe_StrongName_lw2v2vm3wmtzzpebq33gybmeoxukb04w
#>
$ISEPath = "$env:localappdata\microsoft_corporation\powershell_ise*\3.0.0.0"