From 1884a64e37a146e119ee70f568ecdf2f1671b2b7 Mon Sep 17 00:00:00 2001 From: RandolphConley <66429499+RandolphConley@users.noreply.github.com> Date: Wed, 2 Oct 2024 07:14:18 -0400 Subject: [PATCH] Foreach loop to get all local groups, then examine each group's members Code has been modified to accommodate for any language by filtering only on the output and not looking for a string of text --- winPEAS/winPEASps1/winPEAS.ps1 | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/winPEAS/winPEASps1/winPEAS.ps1 b/winPEAS/winPEASps1/winPEAS.ps1 index 47848c7c..7b6951ce 100644 --- a/winPEAS/winPEASps1/winPEAS.ps1 +++ b/winPEAS/winPEASps1/winPEAS.ps1 @@ -1239,16 +1239,14 @@ Get-SmbShare | Get-SmbShareAccess | ForEach-Object { Write-Host "" if ($TimeStamp) { TimeElapsed } Write-Host -ForegroundColor Blue "=========|| USER INFO" -Write-Host "== || Generating List of all Administrators, Users and Backup Operators (if any exist)" - -@("ADMINISTRATORS", "USERS") | ForEach-Object { - Write-Host $_ - Write-Host "-------" - Start-Process net -ArgumentList "localgroup $_" -Wait -NoNewWindow -} -Write-Host "BACKUP OPERATORS" -Write-Host "-------" -Start-Process net -ArgumentList 'localgroup "Backup Operators"' -Wait -NoNewWindow +Write-Host "== || Generating List of all Local Administrators, Users and Backup Operators (if any exist)" + +# Code has been modified to accomodate for any language by filtering only on the output and not looking for a string of text +# Foreach loop to get all local groups, then examine each group's members. +Get-LocalGroup | ForEach-Object { + "`n Group: $($_.Name) `n" ; if(Get-LocalGroupMember -name $_.Name){ + (Get-LocalGroupMember -name $_.Name).Name} + else{" {GROUP EMPTY}"}} Write-Host ""