Created
January 18, 2016 09:46
-
-
Save tmr232/3ddbe2e558afb367e73e to your computer and use it in GitHub Desktop.
Enable or disable debugger-on-launch for Windows executables
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
| 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