Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Create get_localadministrators.ps1 #302

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions UEM-Samples/Sensors/Windows/get_localadministrators.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Description: Return the current member of local administrators group.
# Execution Context: SYSTEM
# Execution Architecture: EITHER64OR32BIT
# Return Type: STRING

$localadminmember = $(net localgroup administrators) | Where-Object { -not ($_ -match '^-+$|^The command completed successfully.$|^Members$|^Alias name\s+administrators$|^Comment\s+Administrators have complete and unrestricted access to the computer/domain$|^$') -and $_.Trim() -ne '' }
$memberlist = ($localadminmember -join ";")
write-output $memberlist