Home > Blockchain >  Export multiple local groups members to one text file
Export multiple local groups members to one text file

Time:04-13

Is there a way to Export the the members of certain local groups to a single txt file? Currently I have been doing it as separately for each group remotely using psexec. Here is the code I use:

psexec \\PCName net localgroup "Group1" >C:\TEMP\Group1.txt
psexec \\ PCName net localgroup "Group2" >C:\TEMP\Group2.txt
psexec \\ PCName net localgroup "Group3" >C:\TEMP\Group3.txt
psexec \\ PCName net localgroup "Group4" >C:\TEMP\Group4.txt

pause

Also is there a way to add the PC name and date the the same file?

CodePudding user response:

(for %L in ("Group1" "Group2" "Group3" "Group4") do (echo Report for PCName %~L on            
  • Related