(imported comment written by Lee Wei)
Hi Lalitha,
Here are a few different forms that you might be able to use.
If a group does not have any members, it will not be listed
q: (name of it, members of it) of local groups
A: Administrators, TRADERS\leewei
A: Administrators, TRADERS\Administrator
A: Guests, TRADERS\Guest
A: Users, NT AUTHORITY\INTERACTIVE
A: Users, NT AUTHORITY\Authenticated Users
A: Users, TRADERS\Administrator
A: Users, TRADERS\Standard User
A: Debugger Users, TRADERS\leewei
This one concatenates the members together.
“%0A%0D” is carriage return and linefeed. It should cause the results to be placed on different lines in the console
q: (name of it, concatenations “%0A%0D” of (members of it as string)) of local groups whose (number of members of it > 0)
A: Administrators, TRADERS\leewei%0a%0dTRADERS\Administrator
A: Guests, TRADERS\Guest
A: Users, NT AUTHORITY\INTERACTIVE%0a%0dNT AUTHORITY\Authenticated Users%0a%0dTRADERS\Administrator%0a%0dTRADERS\Standard User
A: Debugger Users, TRADERS\leewei
Another form that might be useful if you need to show all groups, even if no members
q: (name of it, (if (number of members of it > 0) then (concatenations “%0A%0D” of (members of it as string)) else (“No Members”)) ) of local groups
A: Administrators, TRADERS\leewei%0a%0dTRADERS\Administrator
A: Backup Operators, No Members
A: Cryptographic Operators, No Members
A: Distributed COM Users, No Members
A: Event Log Readers, No Members
A: Guests, TRADERS\Guest
A: IIS_IUSRS, No Members
A: Network Configuration Operators, No Members
A: Performance Log Users, No Members
A: Performance Monitor Users, No Members
A: Power Users, No Members
A: Remote Desktop Users, No Members
A: Replicator, No Members
A: Users, NT AUTHORITY\INTERACTIVE%0a%0dNT AUTHORITY\Authenticated Users%0a%0dTRADERS\Administrator%0a%0dTRADERS\Standard User
A: Debugger Users, TRADERS\leewei
Lee Wei