Last active
December 7, 2019 09:47
-
-
Save JLChnToZ/9c46da68fe067a91889d5f10c3df5ace to your computer and use it in GitHub Desktop.
Simple PowerShell script that gives you BSOD
This file contains 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
$winId = [System.Security.Principal.WindowsIdentity]::GetCurrent() | |
$winPrincipal = New-Object System.Security.Principal.WindowsPrincipal($winId) | |
$adminRole = [System.Security.Principal.WindowsBuiltInRole]::Administrator | |
If (-Not $winPrincipal.IsInRole($adminRole)) { | |
$cmdArgs = '-File', $MyInvocation.MyCommand.Path, '-ExecutionPolicy', 'Bypass' | |
Start-Process 'PowerShell' $cmdArgs -Verb RunAs | |
Exit | |
} | |
$memberDef = @' | |
[DllImport("ntdll.dll", SetLastError = true)] | |
public static extern int NtSetInformationProcess(IntPtr hProc, int piClass, ref int pi, int piLen); | |
'@ | |
$ntDll = Add-Type 'NtDll' -MemberDefinition $memberDef -PassThru | |
[System.Diagnostics.Process]::EnterDebugMode() | |
$proc = [System.Diagnostics.Process]::GetCurrentProcess() | |
$val = 1 | |
$ntDll::NtSetInformationProcess($proc.Handle, 0x1D, [ref]$val, 4) | |
$proc.Kill() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script will not harm your computer, but will gives you BSOD (real thing, not fake) after getting administrator privileges.
Remember to save all your stuffs before trying this.