From aff1dcd42d398b21e1372436ef5bc9b4ab081850 Mon Sep 17 00:00:00 2001 From: Adi-Nugraha-T <67138921+Adi-Nugraha-T@users.noreply.github.com> Date: Thu, 15 Feb 2024 01:37:55 +0700 Subject: [PATCH] Create get_localadministrators.ps1 returns the list of local administrators separated by ; --- UEM-Samples/Sensors/Windows/get_localadministrators.ps1 | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 UEM-Samples/Sensors/Windows/get_localadministrators.ps1 diff --git a/UEM-Samples/Sensors/Windows/get_localadministrators.ps1 b/UEM-Samples/Sensors/Windows/get_localadministrators.ps1 new file mode 100644 index 00000000..595e4da1 --- /dev/null +++ b/UEM-Samples/Sensors/Windows/get_localadministrators.ps1 @@ -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