This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using namespace System.Collections.Generic | |
# Encapsulate an arbitrary command | |
class PaneCommand { | |
[string]$Command | |
PaneCommand() { | |
$this.Command = ""; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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 $? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Dynamic_Param_Start": { | |
"prefix": "dynamic1start", | |
"body": [ | |
"DynamicParam {", | |
"\t${1:dynamic2p}${2:}", | |
"}" | |
], | |
"description": "An empty dynamic parameter" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.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 |
NewerOlder