Skip to content

Instantly share code, notes, and snippets.

View jdhitsolutions's full-sized avatar

Jeff Hicks jdhitsolutions

View GitHub Profile
@jdhitsolutions
jdhitsolutions / New-Project.ps1
Last active April 3, 2022 13:10
Use this command to create a new PowerShell project folder. You specify a top level folder and the name of a project. The command will create a Tests sub-folder, a Pester script outline and set the project up in Git. The command will also create a Docs folder and a culture-specific folder for localized help.
#requires -version 4.0
#requires -module Pester
Function New-Project {
<#
.SYNOPSIS
Create a PowerShell project folder.
.DESCRIPTION
Use this command to create a new PowerShell project folder. You specify a top level folder and the name of a project. The command will create a Tests sub-folder, a Pester script outline and set the project up in Git. The command will also create a Docs folder and a culture-specific folder for localized help.
@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 / Test-MyWsMan.ps1
Last active February 13, 2017 23:37
A modified version of Test-WsMan that supports -Quiet and other minor improvements.
#requires -version 4.0
#requires -module Microsoft.WSMan.Management
<#
This is a copy of:
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Test-WSMan 3.0.0.0 Microsoft.WSMan.Management
@jdhitsolutions
jdhitsolutions / SaveVMBitmap.ps1
Last active November 27, 2020 21:16 — forked from BenjaminArmstrong/SaveVMBitmap.ps1
Sample PowerShell script that shows you how to create a .BMP file of the display of a Hyper-V virtual machine.
function Get-VMScreenBMP {
[cmdletbinding()]
Param(
[string]$VMName,
[string]$Computername = $env:computername,
[string]$Path,
[switch]$Passthru
)
$VMMS = Get-WmiObject -Namespace root\virtualization\v2 -Class Msvm_VirtualSystemManagementService -ComputerName $Computername
@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 / 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 / Find-GitTip.ps1
Last active April 9, 2018 15:27
This function will search the Tips.json file from the Git-Tips project on GitHub. You will need to clone or download the git-tips project locally from https://github.com/git-tips/tips.
#requires -version 4.0
Function Find-GitTip {
<#
.Synopsis
Search Git tips
.Description
This function will search the Tips.json file from the Git-Tips project on GitHub. You will need to clone or download the git-tips project locally from https://github.com/git-tips/tips.
.Parameter Text
@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-GitTip.ps1
Last active April 9, 2018 15:27
Use this command to search the tips file that is part of the Git-Tips project on GitHub. The default behavior is to get all tips but you can search for text in a tip title or select a random tip.
#requires -version 4.0
Function Get-GitTip {
<#
.Synopsis
Get Git Tips
.Description
Use this command to search the tips file that is part of the Git-Tips project on GitHub. The default behavior is to get all tips but you can search for text in a tip title or select a random tip.
.Parameter Random
@jdhitsolutions
jdhitsolutions / Compare-Module.ps1
Last active July 31, 2023 21:33
Use this command to compare module versions between what is installed against an online repository like the PSGallery. Results will be automatically sorted by module name.
#requires -version 5.0
# https://gist.github.com/jdhitsolutions/7217ed9293f18e8d454e3f88ecb38b67
Function Compare-Module {
<#
.Synopsis
Compare module versions.
.Description
Use this command to compare module versions between what is installed against an online repository like the PSGallery. Results will be automatically sorted by module name.