PC Review


Reply
Thread Tools Rate Thread

Parsing local groups?

 
 
LWG
Guest
Posts: n/a
 
      30th Sep 2003
I have a server that has 100 local groups configured. What I need to do is
parse the list to a file then push them back into another server. Is that
possible?

The output looks something like: (using net localgroup)

*OWS_1382446396_Administra*OWS_1382446396_advauthor *OWS_157286859_admin
*OWS_157286859_Administrat*OWS_157286859_author *OWS_157286859_browser
*OWS_157286859_Browser (Mi*OWS_157286859_collab *OWS_157286859_Project
Man
*OWS_157286859_Team Member*OWS_157286860_admin
*OWS_157286860_Administrat
*OWS_157286860_Browser (Mi*OWS_157286860_Project Man*OWS_157286861_admin
*OWS_157286861_Administrat*OWS_157286861_Browser (Mi*OWS_157286861_Project
Man
*OWS_157286861_Team Member*OWS_157286863_admin
*OWS_157286863_Administrat
*OWS_157286863_Browser (Mi*OWS_157286863_Project Man*OWS_157286863_Team
Member
*OWS_157286865_admin *OWS_157286865_Administrat*OWS_157286865_Browser
(Mi
*OWS_157286865_Project Man*OWS_157286958_admin
*OWS_157286958_Administrat
*OWS_157286958_Browser (Mi*OWS_157286958_Project Man*OWS_157286958_Team
Member
*OWS_157286960_admin *OWS_157286960_Administrat*OWS_157286960_Browser
(Mi
*OWS_157286960_Project Man*OWS_157286960_Team Member*OWS_157286963_admin
*OWS_157286963_Administrat*OWS_157286963_Browser (Mi*OWS_157286963_Project
Man
*OWS_157286963_Team Member*OWS_157286964_admin
*OWS_157286964_Administrat
*OWS_157286964_Browser (Mi*OWS_157286964_Project Man*OWS_157286966_admin
*OWS_157286966_Administrat*OWS_157286966_Browser (Mi*OWS_157286966_Project
Man
*OWS_157286966_Team Member*OWS_157286967_admin
*OWS_157286967_Administrat
*OWS_157286967_Browser (Mi*OWS_157286967_Project Man*OWS_157286967_Team
Member
*OWS_157287059_admin *OWS_157287059_Administrat*OWS_157287059_Browser
(Mi
*OWS_157287059_Project Man*OWS_157287065_admin
*OWS_157287065_Administrat
*OWS_157287065_Browser (Mi*OWS_157287065_Project Man*OWS_157287065_Team
Member
*OWS_157287067_admin *OWS_157287067_Administrat*OWS_157287067_Browser
(Mi
*OWS_157287067_Project Man*OWS_157287068_admin
*OWS_157287068_Administrat
*OWS_157287068_Browser (Mi*OWS_157287068_Project Man*OWS_157287068_Team
Member
*OWS_157287161_admin *OWS_157287161_Administrat*OWS_157287161_Browser
(Mi
*OWS_157287161_Project Man*OWS_157287161_Team Member*OWS_157287163_admin

The groups should look like

OWS_1382446396_admins
server 8081 admins....

Thx


 
Reply With Quote
 
 
 
 
Jerold Schulman
Guest
Posts: n/a
 
      1st Oct 2003

ADDUSERS from the reskit supplement will dump groups (and membership) and import
them to another server. See the list of tools and pricing at tip 3277 in the
'Tips & Tricks' at http://www.jsiinc.com

On Tue, 30 Sep 2003 11:46:17 -0400, "LWG" <(E-Mail Removed)> wrote:

>I have a server that has 100 local groups configured. What I need to do is
>parse the list to a file then push them back into another server. Is that
>possible?
>
>The output looks something like: (using net localgroup)
>
>*OWS_1382446396_Administra*OWS_1382446396_advauthor *OWS_157286859_admin
>*OWS_157286859_Administrat*OWS_157286859_author *OWS_157286859_browser
>*OWS_157286859_Browser (Mi*OWS_157286859_collab *OWS_157286859_Project
>Man
>*OWS_157286859_Team Member*OWS_157286860_admin
>*OWS_157286860_Administrat
>*OWS_157286860_Browser (Mi*OWS_157286860_Project Man*OWS_157286861_admin
>*OWS_157286861_Administrat*OWS_157286861_Browser (Mi*OWS_157286861_Project
>Man
>*OWS_157286861_Team Member*OWS_157286863_admin
>*OWS_157286863_Administrat
>*OWS_157286863_Browser (Mi*OWS_157286863_Project Man*OWS_157286863_Team
>Member
>*OWS_157286865_admin *OWS_157286865_Administrat*OWS_157286865_Browser
>(Mi
>*OWS_157286865_Project Man*OWS_157286958_admin
>*OWS_157286958_Administrat
>*OWS_157286958_Browser (Mi*OWS_157286958_Project Man*OWS_157286958_Team
>Member
>*OWS_157286960_admin *OWS_157286960_Administrat*OWS_157286960_Browser
>(Mi
>*OWS_157286960_Project Man*OWS_157286960_Team Member*OWS_157286963_admin
>*OWS_157286963_Administrat*OWS_157286963_Browser (Mi*OWS_157286963_Project
>Man
>*OWS_157286963_Team Member*OWS_157286964_admin
>*OWS_157286964_Administrat
>*OWS_157286964_Browser (Mi*OWS_157286964_Project Man*OWS_157286966_admin
>*OWS_157286966_Administrat*OWS_157286966_Browser (Mi*OWS_157286966_Project
>Man
>*OWS_157286966_Team Member*OWS_157286967_admin
>*OWS_157286967_Administrat
>*OWS_157286967_Browser (Mi*OWS_157286967_Project Man*OWS_157286967_Team
>Member
>*OWS_157287059_admin *OWS_157287059_Administrat*OWS_157287059_Browser
>(Mi
>*OWS_157287059_Project Man*OWS_157287065_admin
>*OWS_157287065_Administrat
>*OWS_157287065_Browser (Mi*OWS_157287065_Project Man*OWS_157287065_Team
>Member
>*OWS_157287067_admin *OWS_157287067_Administrat*OWS_157287067_Browser
>(Mi
>*OWS_157287067_Project Man*OWS_157287068_admin
>*OWS_157287068_Administrat
>*OWS_157287068_Browser (Mi*OWS_157287068_Project Man*OWS_157287068_Team
>Member
>*OWS_157287161_admin *OWS_157287161_Administrat*OWS_157287161_Browser
>(Mi
>*OWS_157287161_Project Man*OWS_157287161_Team Member*OWS_157287163_admin
>
>The groups should look like
>
>OWS_1382446396_admins
>server 8081 admins....
>
>Thx
>



Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
Reply With Quote
 
Ritchie
Guest
Posts: n/a
 
      1st Oct 2003
"LWG" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> I have a server that has 100 local groups configured. What I need to do is
> parse the list to a file then push them back into another server. Is that
> possible?


If you're poor, you might try something like this to create the list:-

@echo off & setlocal ENABLEEXTENSIONS
call :EnumLG
goto :EOF

:EnumLG
set "cmd=net localgroup^|findstr/b /c:"*""
for /f "tokens=1-3 delims=*" %%a in ('%cmd%') do (
for %%d in ("%%a" "%%b" "%%c") do call :doit %%d)
goto :EOF

:doit
setlocal
set "b=%1"
set "a=%b: "="%"
if %a%==%b% (endlocal & (if not %b%=="" (echo/[%b:"=%])) & goto :EOF)
endlocal & call :doit %a% %2 & (goto :EOF)

--
Ritchie, undo for mail


 
Reply With Quote
 
Matthias Tacke
Guest
Posts: n/a
 
      2nd Oct 2003
"Ritchie" <(E-Mail Removed)> schrieb
> "LWG" <(E-Mail Removed)> wrote
> > I have a server that has 100 local groups configured. What I need to do

is
> > parse the list to a file then push them back into another server. Is

that
> > possible?

>
> If you're poor, you might try something like this to create the list:-
>

[snip]

I extended the good solution from Ritchie a bit do include
also the users belonging to each group. The output of
"net localgroup username" includes some crap lines, So
you can't automate further without doing an amount of
textreplacements.

But as a documentation for the poor it might be useful.

2 marked lines must be put one line in the batch file

hth
Matthias

***********GrpUsrLs.bat********************
@echo off & setlocal ENABLEEXTENSIONS
echo %date% %time% Group-User-List >GrpUsrLs.txt
call :ruler
del Grp-List.txt
call :EnumLG
type grp-list.txt >> GrpUsrLs.txt
call :ruler
for /F %%f in (grp-list.txt) do (
net localgroup %%f >>GrpUsrLs.txt
call :ruler
)
echo *** Group-List is in File Grp-List.txt ***
echo *** Group-User-List is in file GrpUsrLs.txt ***
goto :EOF

:EnumLG
set "cmd=net localgroup^|findstr/b /c:"*""
for /f "tokens=1-3 delims=*" %%a in ('%cmd%') do (
for %%d in ("%%a" "%%b" "%%c") do call :doit %%d)
goto :EOF

:doit
setlocal
set "b=%1"
set "a=%b: "="%"
if %a%==%b% (endlocal & (if not %b%==""
(echo %b:"=%>>Grp-List.txt)) & goto :EOF)
:: *** concatenate the above 2 lines into one ***
endlocal & call :doit %a% %2 & (goto :EOF)

:ruler
echo =======================================
========================================>>GrpUsrLs.txt
:: *** concatenate the above 2 lines into one ***
goto :EOF


 
Reply With Quote
 
Ritchie
Guest
Posts: n/a
 
      2nd Oct 2003
"Ritchie" <(E-Mail Removed)> wrote in message news:blesbq$bec75$(E-Mail Removed)...
> endlocal & call :doit %a% %2 & (goto :EOF)


BTW, the %2 is completely redundant (remnant of MK I), so the line
above can be written as:-

endlocal & call :doit %a% & (goto :EOF)

BTW BTW, if you edit the ECHO statement in the :doit routine, it can
generate the commands required to create the new groups:-

:doit
setlocal
set "b=%1"
set "a=%b: "="%"
if %a%==%b% (
endlocal & (if not %b%=="" (
echo/net localgroup "%b:"=%" /add)
) & (goto :EOF)
)
endlocal & call :doit %a% & (goto :EOF)

--
Ritchie, undo for mail


 
Reply With Quote
 
LWG
Guest
Posts: n/a
 
      2nd Oct 2003
awesome guys, I am going to try and rebuild the server today...

L
"Ritchie" <(E-Mail Removed)> wrote in message
news:blggvh$c3fji$(E-Mail Removed)...
> "Ritchie" <(E-Mail Removed)> wrote in message

news:blesbq$bec75$(E-Mail Removed)...
> > endlocal & call :doit %a% %2 & (goto :EOF)

>
> BTW, the %2 is completely redundant (remnant of MK I), so the line
> above can be written as:-
>
> endlocal & call :doit %a% & (goto :EOF)
>
> BTW BTW, if you edit the ECHO statement in the :doit routine, it can
> generate the commands required to create the new groups:-
>
> :doit
> setlocal
> set "b=%1"
> set "a=%b: "="%"
> if %a%==%b% (
> endlocal & (if not %b%=="" (
> echo/net localgroup "%b:"=%" /add)
> ) & (goto :EOF)
> )
> endlocal & call :doit %a% & (goto :EOF)
>
> --
> Ritchie, undo for mail
>
>



 
Reply With Quote
 
Adam Wood
Guest
Posts: n/a
 
      2nd Oct 2003
In article <(E-Mail Removed)>, lgovedi1
@tampabay.rr.com says...
> I have a server that has 100 local groups configured. What I need to do is
> parse the list to a file then push them back into another server. Is that
> possible?


You would have to use a separate utility/program to parse the data.
It's relatively simple with Perl...

Alternatively, how about launching the Local Users and Groups MMC scanp-
in, going to Groups, removing all but the name column (View menu) and
then exporting the list (right-click on "Groups" in the tree view).
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Converting local groups to domain local groups Roger Abell [MVP] Microsoft Windows 2000 Security 2 29th Dec 2006 01:57 PM
Re: Converting local groups to domain local groups Joe Richards [MVP] Microsoft Windows 2000 Security 0 27th Dec 2006 07:33 PM
Server Local Groups to AD Domain Local Groups =?Utf-8?B?VGlt?= Microsoft Windows 2000 Active Directory 1 2nd May 2005 07:51 PM
Adding global groups to local admin groups on remote machines Shawn Microsoft Windows 2000 CMD Promt 6 26th Apr 2004 07:51 AM
Groups Policy to assign user to Local Machine Power Users Groups. KA Kueh Microsoft Windows 2000 Group Policy 3 19th Sep 2003 08:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:25 AM.