Skip to content

Instantly share code, notes, and snippets.

@tmr232
Created January 18, 2016 09:46
Show Gist options
  • Select an option

  • Save tmr232/3ddbe2e558afb367e73e to your computer and use it in GitHub Desktop.

Select an option

Save tmr232/3ddbe2e558afb367e73e to your computer and use it in GitHub Desktop.
Enable or disable debugger-on-launch for Windows executables
Param(
[Parameter(Mandatory=$true)]
[string]$ExeName,
[switch]
$Disable
)
{
New-Item -Path "HKLM:\Software\Microsoft\Windows NT\currentversion\image file execution options" -Name $ExeName -Force
if ($Disable)
{
New-ItemProperty -Path "HKLM:\Software\Microsoft\Windows NT\currentversion\image file execution options\$($ExeName)" -Name "Debugger"
}
else
{
New-ItemProperty -Path "HKLM:\Software\Microsoft\Windows NT\currentversion\image file execution options\$($ExeName)" -Name "Debugger" -PropertyType "String" -Value '"C:\Program Files (x86)\Windows Kits\8.1\Debuggers\x64\windbg.exe"'
}
} | Out-Null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment