#29955 - 2002-09-27 10:40 PM
Adding users to the local admin group of all remote PCs
|
Anonymous
Anonymous
Unregistered
|
Question:
Is there a utility or script that has the ability to add doaminaname\globalgroup to the local Administrator group on ALL workstations through the logon script.
I have seen post on how to add users to one computer, however no one has posted anything that would add to all my PC's
laters
|
|
Top
|
|
|
|
#29956 - 2002-09-27 11:04 PM
Re: Adding users to the local admin group of all remote PCs
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Can you run a program from a central console and update the computers remotely. Why do you want to do this via a logon script? If you want to use the logon script, the user will have to have Admin level access or you will have to use SU.exe.
Or you could use GrpMaint.exe if you are an Administrator on all computers.
|
|
Top
|
|
|
|
#29957 - 2002-09-27 11:15 PM
Re: Adding users to the local admin group of all remote PCs
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Radimus, DrillSergeant; could one of move this topic to the "Starters" forum. Thanks Howard.
|
|
Top
|
|
|
|
#29958 - 2002-09-30 06:19 PM
Re: Adding users to the local admin group of all remote PCs
|
Sverre
Getting the hang of it
Registered: 2002-09-29
Posts: 52
|
If I undertsand this correctly I think it's a very good question.
In our office we run a few programs that needs the local user to be a member of the local administrator group. Doing this manualy on all our clients takes a lot of time. Having a script doing it for you would save you hours.
|
|
Top
|
|
|
|
#29959 - 2002-09-30 08:49 PM
Re: Adding users to the local admin group of all remote PCs
|
pc_g0d
Fresh Scripter
Registered: 2001-11-06
Posts: 7
|
I wrote a script that adds groups/users to local admin group on a list of pc's. Ex: you need a newly created group to be in the admin group on a list of pc's. This will do it. I use a command line tool from Windows 2000 resource kit called cusrmgr.exe in order to make this work. Hope this helps.
Here is my code: code:
BREAK ON ;DEBUG ON ;======================== ;= Variables To Edit = ;======================== ;NOTE: I use a domain admin account instead of my own to run this script so I type my other account info below. ;Username Note: This should be the local admin account of the remote PC's. $USERNAME = "administrator" ;Password Note: This should be the local admin password of the remote PC's. ;Special Note: @, %, $ are special characters. If your password contains them please type them twice in a row. ;EX: "$Test@_$" = "$$Test@@_$$" $PWD = "mypassword" ;Drive Letter: This should be the drive letter the script will use to connect to the remote PC's. $drive = "y" ;======================== ;= Do Note Edit Below = ;======================== $ResultCode = SetTitle ("Adding Global Groups") ;Configure Production Local Groups SHELL "%COMSPEC% /C net use $drive: /d >NUL" CLS IF OPEN (1,"PCLIST.TXT",0) = 0 SHELL "%COMSPEC% /C echo PC Name,DOMAIN\Desktop Central,DOMAIN\PDSNE,DOMAIN\PDSSEMA,DOMAIN\PDSWR,DOMAIN\AV Security>> INSTALL_LOG.CSV" $LINEINFO = READLINE(1) WHILE @ERROR = 0 ? "Pcname: $LINEINFO" IF EXIST ("\\$LINEINFO\c$") SHELL "%COMSPEC% /C net use $drive: \\$LINEINFO\c$ /USER:$LINEINFO\$USERNAME $PWD >NUL" IF EXIST ("$drive:") $DOMAINdtc = "" $DOMAINpdsne = "" $DOMAINpdssema = "" $DOMAINpdswr = "" $DOMAINavs = "" ;Add DOMAIN\Desktop Central to Administrators SHELL '%COMSPEC% /C CUSRMGR -u "DOMAIN\Desktop Central" -m "\\$LINEINFO" -alg "Administrators" >NUL' SELECT CASE @ERROR = "0" $DOMAINdtc = "Successfully added to the group" CASE @ERROR = "1378" $DOMAINdtc = "Already in the group" CASE @ERROR = "1722" $DOMAINdtc = "No PC Found" CASE @ERROR = "5" $DOMAINdtc = "Access Denied" CASE @ERROR = "3" $DOMAINdtc = "Can not get SID of group" CASE 1 $DOMAINdtc = "Weird Error" ENDSELECT ;Add DOMAIN\PDSNE to Administrators SHELL '%COMSPEC% /C CUSRMGR -u "DOMAIN\PDSNE" -m "\\$LINEINFO" -alg "Administrators" >NUL' SELECT CASE @ERROR = "0" $DOMAINpdsne = "Successfully added to the group" CASE @ERROR = "1378" $DOMAINpdsne = "Already in the group" CASE @ERROR = "1722" $DOMAINpdsne = "No PC Found" CASE @ERROR = "5" $DOMAINpdsne = "Access Denied" CASE @ERROR = "3" $DOMAINpdsne = "Can not get SID of group" CASE 1 $DOMAINpdsne = "Weird Error" ENDSELECT ;Add DOMAIN\PDSSEMA to Administrators SHELL '%COMSPEC% /C CUSRMGR -u "DOMAIN\PDSSEMA" -m "\\$LINEINFO" -alg "Administrators" >NUL' SELECT CASE @ERROR = "0" $DOMAINpdssema = "Successfully added to the group" CASE @ERROR = "1378" $DOMAINpdssema = "Already in the group" CASE @ERROR = "1722" $DOMAINpdssema = "No PC Found" CASE @ERROR = "5" $DOMAINpdssema = "Access Denied" CASE @ERROR = "3" $DOMAINpdssema = "Can not get SID of group" CASE 1 $DOMAINpdssema = "Weird Error" ENDSELECT ;Add DOMAIN\PDSWR to Administrators SHELL '%COMSPEC% /C CUSRMGR -u "DOMAIN\PDSWR" -m "\\$LINEINFO" -alg "Administrators" >NUL' SELECT CASE @ERROR = "0" $DOMAINpdswr = "Successfully added to the group" CASE @ERROR = "1378" $DOMAINpdswr = "Already in the group" CASE @ERROR = "1722" $DOMAINpdswr = "No PC Found" CASE @ERROR = "5" $DOMAINpdswr = "Access Denied" CASE @ERROR = "3" $DOMAINpdswr = "Can not get SID of group" CASE 1 $DOMAINpdswr = "Weird Error" ENDSELECT ;Add DOMAIN\AV Security to Administrators SHELL '%COMSPEC% /C CUSRMGR -u "DOMAIN\AV Security" -m "\\$LINEINFO" -alg "Administrators" >NUL' SELECT CASE @ERROR = "0" $DOMAINavs = "Successfully added to the group" CASE @ERROR = "1378" $DOMAINavs = "Already in the group" CASE @ERROR = "1722" $DOMAINavs = "No PC Found" CASE @ERROR = "5" $DOMAINavs = "Access Denied" CASE 1 $DOMAINavs = "Weird Error" ENDSELECT ELSE $DOMAINdtc = "Access Denied" ENDIF ;Log pcname and status to INSTALL_LOG.CSV SHELL "%COMSPEC% /C echo $LINEINFO,$DOMAINdtc,$DOMAINpdsne,$DOMAINpdssema,$DOMAINpdswr,$DOMAINavs>> INSTALL_LOG.CSV" ELSE SHELL "%COMSPEC% /C echo $LINEINFO,Unavailable>> INSTALL_LOG.CSV" ENDIF SHELL "%COMSPEC% /C net use $drive: /d >NUL" $LINEINFO = READLINE(1) LOOP $RC = CLOSE (1) ENDIF EXIT
_________________________
Move out of my way or I'll replace you with a kix script.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 657 anonymous users online.
|
|
|