Skip to content

Instantly share code, notes, and snippets.

View mikedopp's full-sized avatar
💭
writing you favorite code

Mike Dopp mikedopp

💭
writing you favorite code
View GitHub Profile
@codebykyle
codebykyle / connect.ps1
Last active March 20, 2025 00:57
Windows Terminal Split Pane Powershell Script - v2
using namespace System.Collections.Generic
# Encapsulate an arbitrary command
class PaneCommand {
[string]$Command
PaneCommand() {
$this.Command = "";
}
@abix-
abix- / OneNote.ps1
Last active March 3, 2023 16:51
Converting between OneNote Tables and PowerShell PSObject
function Get-1NotePage {
<#
.SYNOPSIS
Finds the ID of a OneNote page
.DESCRIPTION
http://thebackend.info/powershell/2017/12/onenote-read-and-write-content-with-powershell/
.EXAMPLE
Get-1NotePage -Name "PowerShell Test"
#>
[cmdletbinding()]
@markwragg
markwragg / Check-Modules.ps1
Last active January 30, 2025 03:42
Check for out of date PowerShell modules
$Modules = Get-Module -ListAvailable |
Where-Object { $_.RepositorySourceLocation -like '*powershellgallery*'} |
Group-Object Name |
ForEach-Object { $_.Group | Sort-Object Version -Descending | Select-Object -First 1 }
$ModuleCheck = ForEach ($Module in $Modules) {
Find-Module -Name $Module | Select-Object Name,Version,@{N='InstalledVersion';E={$Module.Version}}
}
$OutOfDateModules = $ModuleCheck | Where-Object {[version]$_.Version -gt [version]$_.InstalledVersion}
@chrisdpa-tvx
chrisdpa-tvx / install_java.ps1
Last active June 1, 2021 18:00
Install Java JRE on windows silently using powershell
$URL=(Invoke-WebRequest -UseBasicParsing https://www.java.com/en/download/manual.jsp).Content | %{[regex]::matches($_, '(?:<a title="Download Java software for Windows Online" href=")(.*)(?:">)').Groups[1].Value}
Invoke-WebRequest -UseBasicParsing -OutFile jre8.exe $URL
Start-Process .\jre8.exe '/s REBOOT=0 SPONSORS=0 AUTO_UPDATE=0' -wait
echo $?
@jdhitsolutions
jdhitsolutions / ConvertTo-Markdown.ps1
Created August 15, 2018 14:50
Convert pipeline output to a markdown document
#requires -version 5.0
Function ConvertTo-Markdown {
<#
.Synopsis
Convert pipeline output to a markdown document.
.Description
This command is designed to accept pipelined output and create a markdown document. The pipeline output will formatted as a text block. You can optionally define a title, content to appear before the output and content to appear after the output.
The command does not create a text file. You need to pipe results from this command to a cmdlet like Out-File or Set-Content. See examples.
.Parameter Title
#!/usr/bin/env python
##
# stop.py (short for Salt TOP)
# A quick and dirty way to check out running Salt-master processes without having to dig through a bunch of JSON
# Seems to work OK with Python 3
#
# Example Output:
#
# Start_Time, Key, Running, Arguments, KillString
# 2018, Jul 17 08:24:39.379270 , 20180717082439379270 , SERVER1.local , state.apply , [], KILL_STRING: salt 'SERVER1.local' saltutil.kill_job 20180717082439379270
@quonic
quonic / powershell.json
Last active April 29, 2023 05:36
A Powershell DynamicParam snippet for VSCode
{
"Dynamic_Param_Start": {
"prefix": "dynamic1start",
"body": [
"DynamicParam {",
"\t${1:dynamic2p}${2:}",
"}"
],
"description": "An empty dynamic parameter"
},
@IISResetMe
IISResetMe / Capture-Gif.ps1
Created July 4, 2018 00:50
Gif capturer in PowerShell
# PowerShell gif encoding + wrapper around https://www.developerfusion.com/code/4630/capture-a-screen-shot/
Add-Type -TypeDefinition @'
using System;
using System.Runtime.InteropServices;
using System.Drawing;
using System.Drawing.Imaging;
namespace GDI
{
/// <summary>
@mdowst
mdowst / Search-PSScripts.ps1
Last active November 29, 2018 20:53
A PowerShell function usedto search the text inside PowerShell scripts for a particular string
Function Search-PSScripts{
<#
.SYNOPSIS
Use to search the text inside PowerShell scripts for a particular string
.PARAMETER SearchString
The string to search for inside the script file
.PARAMETER Path
The folder path to search for PowerShell files in. Default to userprofile if not specified.
@realslacker
realslacker / Enable-VSSShadowCopies.ps1
Created June 6, 2018 15:34
Enable VSS Shadow Copies on remote computers.
<#
.SYNOPSIS
Enable VSS Shadow Copies on remote computers.
.DESCRIPTION
Enable VSS Shadow Copies on remote computers. The default settings will take a snapshot every 1 hour and use up to 5% of the disk.
.PARAMETER ComputerName
The computer(s) to enable VSS on. If piping from Get-ADComputer use 'Get-ADComputer -Filter * | select Name' to handle a bug in Get-ADComputer's piping.
.PARAMETER DriveLetter
Which drive to enable VSS on.
.PARAMETER CacheSize