You can get the results of groups with no members easily with: (name of it & ":No Members:N/A") of local groups whose(not exists members of it)
Q: (name of it & ":No Members:N/A") of local groups whose(not exists members of it)
A: Access Control Assistance Operators:No Members:N/A
A: Backup Operators:No Members:N/A
A: Cryptographic Operators:No Members:N/A
A: Distributed COM Users:No Members:N/A
A: Event Log Readers:No Members:N/A
A: Hyper-V Administrators:No Members:N/A
A: IIS_IUSRS:No Members:N/A
A: Network Configuration Operators:No Members:N/A
A: Performance Log Users:No Members:N/A
A: Performance Monitor Users:No Members:N/A
A: Power Users:No Members:N/A
A: Remote Management Users:No Members:N/A
A: Replicator:No Members:N/A
A: System Managed Accounts Group:No Members:N/A
T: 10.337 ms
I: plural string
Then to get those with members: (item 0 of it & ":" & item 1 of it & ":" & (account disabled flag of item 2 of it as string | "Not Local Account") ) of (names of it, (it as string) of members of it, users) whose( ( "\" & name of item 2 of it) is contained by item 1 of it) of local groups
Q: (item 0 of it & ":" & item 1 of it & ":" & (account disabled flag of item 2 of it as string | "Not Local Account") ) of (names of it, (it as string) of members of it, users) whose( ( "\" & name of item 2 of it) is contained by item 1 of it) of local groups
A: Administrators:_HOST_\Administrator:True
Put it all together:
( (item 0 of it & ":" & item 1 of it & ":" & (account disabled flag of item 2 of it as string | "Not Local Account") ) of (names of it, (it as string) of members of it, users) whose( ( "\" & name of item 2 of it) is contained by item 1 of it) of local groups ) ; ( (name of it & ":No Members:N/A") of local groups whose(not exists members of it) )
Sometimes it is much easier to have 2 separate logic paths for the different cases than have a single logic path handle the complexity of both.
You can actually measure the performance of these statements for a given system by looking at the execution time without outputting the results themselves by adding number of
in front just to hide the results while looking for the approximate execution time:
Q: number of (name of it & ":No Members:N/A") of local groups whose(not exists members of it)
A: 14
T: 9.673 ms
I: singular integer
Q: number of (item 0 of it & ":" & item 1 of it & ":" & (account disabled flag of item 2 of it as string | "Not Local Account") ) of (names of it, (it as string) of members of it, users) whose( ( "\" & name of item 2 of it) is contained by item 1 of it) of local groups
A: 10
T: 61.234 ms
I: singular integer
Q: number of ( ( (item 0 of it & ":" & item 1 of it & ":" & (account disabled flag of item 2 of it as string | "Not Local Account") ) of (names of it, (it as string) of members of it, users) whose( ( "\" & name of item 2 of it) is contained by item 1 of it) of local groups ) ; ( (name of it & ":No Members:N/A") of local groups whose(not exists members of it) ) )
A: 24
T: 76.405 ms
I: singular integer
Q: number of (item 0 of it & ":" & item 0 of item 1 of it as string & ":" & item 1 of item 1 of it as string) of (name of it, (if (number of members of it > 0) then ((it, (if (exists (it, users) whose ((if (item 0 of it contains "\") then (following text of first "\" of item 0 of it) else (item 0 of it)) as lowercase = name of item 1 of it as lowercase)) then ((account disabled flag of item 1 of it as string) of (it, users) whose ((if (item 0 of it contains "\") then (following text of first "\" of item 0 of it) else (item 0 of it)) as lowercase = name of item 1 of it as lowercase)) else ("Not Local Account"))) of (it as string) of members of it) else ("No Members", "N/A"))) of local groups whose ((name of it contains "Administrators") or (name of it contains "Backup Operators") or (name of it contains "Guest") or (name of it contains "Power Users") or (name of it contains "Replicator") or (name of it contains "Users"))
A: 20
T: 89.279 ms
I: singular integer