|
| ||||||||||
| Tags: global, groups, local |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Getting a list of users in global and local groups.
text file that shows all the users I have in my domain groups. It keeps on giving me a message of something like "group not found" (I'm not near a dc to give the exact error) I noted the line numbers in this string. Any ideas how to make this work ? Line 1@echo off Line 2 if exist c:\Groups.txt del c:\Groups.txt Line 3 for /F "tokens=*" %%* in ('net localgroup ^| find "*"') do call :Sub %%* Line 4 for /F "tokens=*" %%* in ('net groups /domain ^| find "*"') do call :Sub %%* Line 5 goto :eof Line 6 :sub Line 7 set name=%* Line 8 net group "%name:~1%" | find /i /v "comment" | find /i /v "members" | find /i /v "--------------" | find /i /v "completed successfully" >> c:\Groups.txt |
|
#2
| |||
| |||
| Re: Getting a list of users in global and local groups. "Joe" <joe@charter.net> wrote in message news:1F14D37A-93AA-47AE-A7D1-7A7BD22EE975@microsoft.com... >I found this batch file on a newsgroup a while back, I'm trying to get a >text file that shows all the users I have in my domain groups. It keeps on >giving me a message of something like "group not found" (I'm not near a dc >to give the exact error) I noted the line numbers in this string. > > Any ideas how to make this work ? > > Line 1@echo off > Line 2 if exist c:\Groups.txt del c:\Groups.txt > Line 3 for /F "tokens=*" %%* in ('net localgroup ^| find "*"') do call > :Sub %%* > Line 4 for /F "tokens=*" %%* in ('net groups /domain ^| find "*"') do call > :Sub %%* > Line 5 goto :eof > Line 6 :sub > Line 7 set name=%* > Line 8 net group "%name:~1%" | find /i /v "comment" | find /i /v "members" > | find /i /v "--------------" | find /i /v "completed successfully" >> > c:\Groups.txt This looks like a batch file I designed for someone else last November. It works quite nicely, provided that you don't have any "poison" characters in your group names. To see for yourself, insert these lines immediately after Line 7 and report the result: echo Name=%name% pause |
|
#3
| |||
| |||
| Re: Getting a list of users in global and local groups.
It displays groups when adding the echo, however, it still responds with "the group name can not be found". Additionally, the groups.txt file is created, but nothing is written to it. |
|
#4
| |||
| |||
| Re: Getting a list of users in global and local groups. <cmail0925@gmail.com> wrote in message news:1188486846.404952.64320@k79g2000hse.googlegroups.com... > It displays groups when adding the echo, however, it still responds > with "the group name can not be found". Additionally, the groups.txt > file is created, but nothing is written to it. > Are you "Joe"? Post the exact batch file you're using! |
|
#5
| |||
| |||
| Re: Getting a list of users in global and local groups.
Yes, that is me at work.. I posted the exact batch file in the original thread. I'm applying it on a Windows 2003 dc with the default groups. I did create a a test group and it echoed through along with all the others with the echo command you gave me. However, I just get a blank file in the root directory. "Pegasus (MVP)" <I.can@fly.com> wrote in message news:OetDfpz6HHA.5844@TK2MSFTNGP02.phx.gbl... > > <cmail0925@gmail.com> wrote in message > news:1188486846.404952.64320@k79g2000hse.googlegroups.com... >> It displays groups when adding the echo, however, it still responds >> with "the group name can not be found". Additionally, the groups.txt >> file is created, but nothing is written to it. >> > > Are you "Joe"? > > Post the exact batch file you're using! > |
|
#6
| |||
| |||
| Re: Getting a list of users in global and local groups.
I beg to disagree. Your original post had the string "Line 1", "Line 2" at the beginning of each line. This batch file could not possibly work. I've been in this game for too long to consider something such as "The batch file looked like this". I need the real thing! "Joe" <joe@charter.net> wrote in message news:CDB2E2E6-9122-4E7F-83F5-7C309E8CFA70@microsoft.com... > Yes, that is me at work.. > > I posted the exact batch file in the original thread. I'm applying it on a > Windows 2003 dc with the default groups. > I did create a a test group and it echoed through along with all the > others with the echo command you gave me. > However, I just get a blank file in the root directory. > > > "Pegasus (MVP)" <I.can@fly.com> wrote in message > news:OetDfpz6HHA.5844@TK2MSFTNGP02.phx.gbl... >> >> <cmail0925@gmail.com> wrote in message >> news:1188486846.404952.64320@k79g2000hse.googlegroups.com... >>> It displays groups when adding the echo, however, it still responds >>> with "the group name can not be found". Additionally, the groups.txt >>> file is created, but nothing is written to it. >>> >> >> Are you "Joe"? >> >> Post the exact batch file you're using! >> > |
|
#7
| |||
| |||
| Re: Getting a list of users in global and local groups.
Here you go... @echo off if exist c:\Groups.txt del c:\Groups.txt for /F "tokens=*" %%* in ('net localgroup ^| find "*"') do call :Sub % %* for /F "tokens=*" %%* in ('net groups /domain ^| find "*"') do call :Sub %%* goto :eof :sub set name=%* echo Name=%name% net group "%name:~1%" | find /i /v "comment" | find /i /v "members" | find /i /v "--------------" | find /i /v "completed successfully" >> c: \Groups.txt |
|
#8
| |||
| |||
| Re: Getting a list of users in global and local groups.
The batch file you posted works very nicely on my machines. Here is a modified version you could try. You must remove the # characters that marks the start of each line. #@echo off #if exist c:\Groups.txt del c:\Groups.txt #set parm=Localgroup #for /F "tokens=*" %%* in ('net localgroup ^| find "*"') do call :Sub %%* #set parm=Group #for /F "tokens=*" %%* in ('net groups /domain ^| find "*"') do call :Sub %%* #notepad c:\Groups.txt #goto :eof # #:Sub #set name=%* #echo Group name: %name% #echo %parm% name: %name:~1% >> c:\Groups.txt #net %parm% "%name:~1%" | find /i /v "completed successfully" | more +6 >> c:\Groups.txt If this version still does not work then you must post the output generated by the following commands: net localgroup net localgroup administrators net groups /domain net groups /domain "domain admins" <cmail0925@gmail.com> wrote in message news:1188572920.392066.284600@r34g2000hsd.googlegroups.com... > Here you go... > > @echo off > if exist c:\Groups.txt del c:\Groups.txt > for /F "tokens=*" %%* in ('net localgroup ^| find "*"') do call :Sub % > %* > for /F "tokens=*" %%* in ('net groups /domain ^| find "*"') do > call :Sub %%* > goto :eof > :sub > set name=%* > echo Name=%name% > net group "%name:~1%" | find /i /v "comment" | find /i /v "members" | > find /i /v "--------------" | find /i /v "completed successfully" >> c: > \Groups.txt > |
|
#9
| |||
| |||
| Re: Getting a list of users in global and local groups.
Ok, I'll try this on Tuesday when I'm back at work. Thanks! "Pegasus (MVP)" <I.can@fly.com> wrote in message news:%23n53Nm%236HHA.484@TK2MSFTNGP06.phx.gbl... > The batch file you posted works very nicely on my machines. > Here is a modified version you could try. You must remove > the # characters that marks the start of each line. > #@echo off > #if exist c:\Groups.txt del c:\Groups.txt > #set parm=Localgroup > #for /F "tokens=*" %%* in ('net localgroup ^| find "*"') do call :Sub %%* > #set parm=Group > #for /F "tokens=*" %%* in ('net groups /domain ^| find "*"') do call :Sub > %%* > #notepad c:\Groups.txt > #goto :eof > # > #:Sub > #set name=%* > #echo Group name: %name% > #echo %parm% name: %name:~1% >> c:\Groups.txt > #net %parm% "%name:~1%" | find /i /v "completed successfully" | more +6 >> > c:\Groups.txt > > If this version still does not work then you must post the > output generated by the following commands: > net localgroup > net localgroup administrators > net groups /domain > net groups /domain "domain admins" > > > <cmail0925@gmail.com> wrote in message > news:1188572920.392066.284600@r34g2000hsd.googlegroups.com... >> Here you go... >> >> @echo off >> if exist c:\Groups.txt del c:\Groups.txt >> for /F "tokens=*" %%* in ('net localgroup ^| find "*"') do call :Sub % >> %* >> for /F "tokens=*" %%* in ('net groups /domain ^| find "*"') do >> call :Sub %%* >> goto :eof >> :sub >> set name=%* >> echo Name=%name% >> net group "%name:~1%" | find /i /v "comment" | find /i /v "members" | >> find /i /v "--------------" | find /i /v "completed successfully" >> c: >> \Groups.txt >> > > |
|
#10
| |||
| |||
| Re: Getting a list of users in global and local groups.
I ran the script, but all that pops up is one local group called _vmware_ |
|
#11
| |||
| |||
| Re: Getting a list of users in global and local groups.
<cmail0925@gmail.com> wrote in message news:1189031270.652666.278240@k79g2000hse.googlegroups.com... >I ran the script, but all that pops up is one local group called > _vmware_ > I cannot help you any further unless you're prepared to run the diagnostic stuff I mentioned in my last reply. |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Getting a list of users in global and local groups." | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| I need an AD tool to list of all users, groups and permission | fmgt1999 | Active Directory | 4 | 26-02-2009 01:21 AM |
| Active Directory - need a list of all users, groups and permission | Achraj | Window 2000 Help | 1 | 09-10-2007 02:23 AM |
| Missing Local Users and Groups | pushpendra | Small Business Server | 3 | 14-02-2007 09:30 AM |
| Missing - Local USers and Groups | Susan Bradley | Windows XP Support | 2 | 03-10-2005 03:45 PM |
| How to export list of users from each global, domain, local group? | Manik | Active Directory | 1 | 10-06-2005 07:52 AM |