Skip to content

Instantly share code, notes, and snippets.

View jdhitsolutions's full-sized avatar

Jeff Hicks jdhitsolutions

View GitHub Profile
@jdhitsolutions
jdhitsolutions / ISEToDo.ps1
Created July 1, 2016 14:41
Add a menu shortcut in the PowerShell ISE to insert a dated ToDo comment
#Insert a ToDo comment in an ISE script file
$action = {
$psise.CurrentFile.Editor.InsertText("# [$((Get-Date).ToShortDateString())] ToDo: ")
#jump cursor to the end
$psise.CurrentFile.editor.SetCaretPosition($psise.CurrentFile.Editor.CaretLine,$psise.CurrentFile.Editor.CaretColumn)
}
#add the action to the Add-Ons menu
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add("ToDo",$Action,"Alt+2" ) | Out-Null
@jdhitsolutions
jdhitsolutions / Send-PopupMessage.ps1
Created July 7, 2016 19:56
This command is a PowerShell wrapper for the MSG.EXE command line tool. You can use this to display a popup message for yourself, or users on remote computers.
#requires -version 4.0
#originally from http://poshcode.org/5085
Function Send-PopupMessage {
<#
.SYNOPSIS
Send a graphical popup message.
.DESCRIPTION
@jdhitsolutions
jdhitsolutions / Test-IsPrime.ps1
Last active December 20, 2023 03:57
A PowerShell function to test if a number is prime.
Function Test-IsPrime {
<#
.Synopsis
Test if a number is prime
.Description
This command will test if a given number is prime based.
.Example
@jdhitsolutions
jdhitsolutions / Get-AVStatus.ps1
Last active February 17, 2024 23:33
This PowerShell function uses WMI via the Get-CimInstance command to query the state of installed anti-virus products.
#requires -version 5.1
Function Get-AVStatus {
<#
.Synopsis
Get anti-virus product information.
.Description
This command uses WMI via the Get-CimInstance command to query the state of installed anti-virus products. The default behavior is to only display enabled products, unless you use -All. You can query by computername or existing CIMSessions.
.Example
@jdhitsolutions
jdhitsolutions / ToDo.ps1
Last active November 13, 2020 18:05
A PowerShell function that you can use to insert ToDo messages into your scripts and functions.
<#
based on a comment from Matt Penny
function todo {
param ([string]$TodoText)
write-host -foregroundcolor DarkYellow ” [o] Todo: $TodoText”
}
Get more from Matt at https://mattypenny.net/
@jdhitsolutions
jdhitsolutions / Test-IsNanoServer.ps1
Last active July 11, 2019 16:56
A PowerShell function to test if a remote computer is a Nano installation.
#Requires -version 3.0
<#
Test-IsNanoServer.ps1
****************************************************************
* DO NOT USE IN A PRODUCTION ENVIRONMENT UNTIL YOU HAVE TESTED *
* THOROUGHLY IN A LAB ENVIRONMENT. USE AT YOUR OWN RISK. IF *
* YOU DO NOT UNDERSTAND WHAT THIS SCRIPT DOES OR HOW IT WORKS, *
* DO NOT USE IT OUTSIDE OF A SECURE, TEST SETTING. *
@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"
@jdhitsolutions
jdhitsolutions / Test-UpOrDown.ps1
Last active November 13, 2020 18:05
A PowerShell function that uses the web site DownForEveryoneOrJustme.com to test is a web site or domain is up or down
#requires -version 4.0
Function Test-UporDown {
<#
.Synopsis
Test if a web site is down or if it is just you.
.Description
The function uses the web site DownForEveryoneOrJustme.com to test is a web site or domain is up or down, or if the problem is just you. The command will write a custom object to the pipeline. See examples.
@jdhitsolutions
jdhitsolutions / Weekly.tests.ps1
Last active March 10, 2022 02:40
A fun Pester test for testing days of the week.
#requires -version 5.0
<#
Weekly.tests.ps1
a Pester test for the week
Usage: Invoke-Pester .\Weekly.tests.ps1
#>
@jdhitsolutions
jdhitsolutions / Reset-LCM.ps1
Created January 23, 2017 17:52
A DSC configuration to reset the local configuration manager
Param(
[string[]]$Computername = "chi-test02"
)
[DscLocalConfigurationManager()]
Configuration ResetLCM {
Param([string[]]$Computername)