Advertisement
digininja

PS Check if admin

Oct 4th, 2022
1,218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
  2. $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
  3.  
Tags: powershell
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement