Skip to content

Latest commit

 

History

History
126 lines (96 loc) · 3.48 KB

File metadata and controls

126 lines (96 loc) · 3.48 KB

Logo

Table of Contents
  1. Description
  2. The Function
  3. Examples
  4. Contact
  5. Acknowledgments

If-Admin

Python
YouTube Tutorial

Description

These functions are used to determine if you have Admin level privledges

The Function

[If-Admin-Window]

This function will let you know if you are currently in an Admin Privledge Level window

function If-Admin-Window {  
	$user = [Security.Principal.WindowsIdentity]::GetCurrent();
	$isAdmin = (New-Object Security.Principal.WindowsPrincipal $user).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)  
	
if($isAdmin){
	Write-host 'Is Admin Window' -BackgroundColor DarkRed -ForegroundColor White
	}
	else{
	Write-host 'Not Admin Window' -BackgroundColor DarkBlue -ForegroundColor White
	}
}

[If-Admin]

This function will run the current user against LocalGroupMember to return True or False if Profile has Admin Privledges

function If-Admin {
	$user = "$env:COMPUTERNAME\$env:USERNAME"
	$isAdmin = (Get-LocalGroupMember 'Administrators').Name -contains $user
if($isAdmin){
	Write-host 'Is Admin' -BackgroundColor DarkRed -ForegroundColor White
	}
	else{
	Write-host 'Not Admin' -BackgroundColor DarkBlue -ForegroundColor White
	}
}

(back to top)

Examples

Listed below are payloads that have used one of these functions:

No current Examples to show. Please feel free to submit your own payload of you using this function

(back to top)

Contact

📱 My Socials 📱

C#
YouTube
Python
Twitter
Golang
Instagram
Jsonnet
Discord

(back to top)

Acknowledgments


HOME-PAGE

(back to top)