Skip to content

Instantly share code, notes, and snippets.

View PrivateLocker's full-sized avatar

Private-Locker, LLC PrivateLocker

View GitHub Profile
@PrivateLocker
PrivateLocker / disable.ps1
Created January 5, 2020 01:32
DisableD3f3nd3r
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
$arguments = "& '" + $myinvocation.mycommand.definition + "'"
Start-Process powershell -Verb runAs -ArgumentList $arguments
Break
}
function Check-IsElevated
{
$id = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$p = New-Object System.Security.Principal.WindowsPrincipal($id)