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

Commit

Permalink
Create get_localadministrators.ps1
Browse files Browse the repository at this point in the history
returns the list of local administrators separated by ;
  • Loading branch information
Adi-Nugraha-T authored Feb 14, 2024
1 parent e5d2fa3 commit aff1dcd
Showing 1 changed file with 8 additions and 0 deletions.
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

0 comments on commit aff1dcd

Please sign in to comment.