Skip to content

Instantly share code, notes, and snippets.

View kwestground's full-sized avatar

Kenny Westermark kwestground

View GitHub Profile
@atao
atao / RunAsAdmin.ps1
Last active October 15, 2025 13:05
🕵️ Self privileges escalation with PowerShell.
#Requires -RunAsAdministrator
#OneLine
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit }
#Or example :
# Store the current location
$Loc = Get-Location