Skip to content

Instantly share code, notes, and snippets.

@IISResetMe IISResetMe/TypoHijack.ps1
Last active Mar 14, 2019

What would you like to do?
Hijack a subset of non-existing commands in PowerShell
$ExecutionContext.InvokeCommand.CommandNotFoundAction = {
param([string]$CommandName, [System.Management.Automation.CommandLookupEventArgs]$evtArgs)
if($CommandName -like '*glue*'){
$evtArgs.CommandScriptBlock = {
Write-Host "Eating glue because of $CommandName ..." -ForegroundColor Green
$evtArgs.StopSearch = $true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.