I am setting up a user group and user audit/review process. For this I am looking for a script that can easily generate a list of groups and the assigned users. E.g.:
Administrators/Administrator Administrators/Account1 Administrators/Account2 SomeOtherGroup/Accounts2
Answer
You can use net localgroups
to get a list of groups on the local machine, and net user
to get a list of users. You can then use net user USERNAME
to get a list of groups that the user is in. It will require a bit of scripting to put it all together though.
Attribution
Source : Link , Question Author : Kumala , Answer Author : devicenull