#119443 - 2004-05-12 10:38 PM
Is Script OK?
|
Sardis
Fresh Scripter
Registered: 2004-01-16
Posts: 28
Loc: Montgomery, AL
|
Is there anything wrong with this code? For some reason when I try to run it through Group Policies, the last statement does not run. Code:
SetConsole("SHOW")
SELECT CASE @LDOMAIN="TURENNETEAM" goto TURENNETEAM CASE @LDOMAIN="MCGUFFEYTEAM" goto MCGUFFEYTEAM CASE @LDOMAIN="CAPITOLHILLTEAM" goto CAPITOLHILLTEAM CASE @LDOMAIN="WESTSIDETEAM" goto WESTSIDETEAM CASE @LDOMAIN="PMCOTEAM" goto PMCOTEAM CASE 1 "You are not a part of a domain" ENDSELECT
goto END
:TURENNETEAM ;*****map network drives****************************************** USE "*" /DELETE USE P: "\\TURENNE-NAS1\HO\NETDRIVE" ;*****delete all printers to clear out old printer mappings******* deltree("HKEY_CURRENT_USER\Printers\Connections") ;*****add these current printers back***************************** addprinterconnection ("\\TURENNEMSTR\HO - Savin2535") addprinterconnection ("\\TURENNEMSTR\HO - LJ2200") addprinterconnection ("\\TURENNEBKUP\CHC - BO - LJ1200") addprinterconnection ("\\TURENNEBKUP\CHC - Payroll - LJ2200") addprinterconnection ("\\TURENNEBKUP\MHC - Office - Savin9922") addprinterconnection ("\\TURENNEBKUP\MHC - BO - LJ4050") addprinterconnection ("\\TURENNEBKUP\WST - BO - LJ4200") addprinterconnection ("\\TURENNEBKUP\WST - DON - LJ2200") ;*****end TURENNETEAM section and stop script********************* goto END
:MCGUFFEYTEAM ;*****map network drives****************************************** If InGroup ("MCGUFFEYTEAM\Domain Users") USE "*" /DELETE USE P: "\\MHC2K02\NETDRIVE" EndIf ;*****delete all printers to clear out old printer mappings******* deltree("HKEY_CURRENT_USER\Printers\Connections") ;*****add these current printers back***************************** ; SELECT ; CASE InGroup ("1st Hall") ; CASE InGroup ("2nd Hall") ; CASE InGroup ("3rd Hall") ; CASE InGroup ("4th Hall") ; CASE InGroup ("5th Hall") ; CASE InGroup ("Business Office") ; CASE InGroup ("Etc...Etc...Etc") ; ENDSELECT addprinterconnection ("\\TURENNEBKUP\MHC - Office - Savin9922") addprinterconnection ("\\TURENNEBKUP\MHC - BO - LJ4050") addprinterconnection ("\\TURENNEBKUP\MHC - 2ndHall - LJ4Plus") addprinterconnection ("\\TURENNEBKUP\MHC - Dietary - LJ2300") addprinterconnection ("\\TURENNEBKUP\MHC - Payroll - LJ2200") addprinterconnection ("\\TURENNEBKUP\MHC - 4thHall - LJ1300N") ;*****end MCGUFFEYTEAM section and stop script*********************
goto END
:CAPITOLHILLTEAM ;*****map network drives****************************************** If InGroup ("CAPITOLHILLTEAM\Domain Users") USE "*" /DELETE USE P: "\\CHC2K01\NETDRIVE" EndIf ;*****delete all printers to clear out old printer mappings******* deltree("HKEY_CURRENT_USER\Printers\Connections") ;*****add these current printers back***************************** ; SELECT ; CASE InGroup ("One North") ; CASE InGroup ("Two North") ; CASE InGroup ("Three North") ; CASE InGroup ("Two South") ; CASE InGroup ("Three South") ; CASE InGroup ("Business Office") ; CASE InGroup ("Etc...Etc...Etc") ; ENDSELECT addprinterconnection ("\\TURENNEBKUP\CHC - 1West - LJ1300N") addprinterconnection ("\\TURENNEBKUP\CHC - 2North - LJ1300N") addprinterconnection ("\\TURENNEBKUP\CHC - 2South - LJ1300N") addprinterconnection ("\\TURENNEBKUP\CHC - 3North - LJ1300N") addprinterconnection ("\\TURENNEBKUP\CHC - 3South - LJ1300N") addprinterconnection ("\\TURENNEBKUP\CHC - BO - LJ1200") addprinterconnection ("\\TURENNEBKUP\CHC - HR - LJ1300N") addprinterconnection ("\\TURENNEBKUP\CHC - OneWest - LJ4050") addprinterconnection ("\\TURENNEBKUP\CHC - Payroll - LJ2200") addprinterconnection ("\\TURENNEBKUP\CHC - Rehab1 - LJ1300N") addprinterconnection ("\\TURENNEBKUP\CHC - RehabDirector - DJ845c") addprinterconnection ("\\TURENNEBKUP\CHC - 1West - LJ1300N") addprinterconnection ("\\TURENNEBKUP\CHC - Reception - Phaser850N") ;*****end CAPITOLHILLTEAM section and stop script*********************
goto END
:WESTSIDETEAM ;*****map network drives****************************************** If InGroup ("WESTSIDETEAM\Domain Users") USE "*" /DELETE USE F: "\\wst2k03\file-server-data" USE G: "\\wst2k03\NetApps" USE H: "\\wst2k03\Users\@userid" USe S: "\\wst2k03\Depts" EndIf ;*****delete all printers to clear out old printer mappings******* deltree("HKEY_CURRENT_USER\Printers\Connections") ;*****add these current printers back***************************** SELECT CASE InGroup ("WESTSIDETEAM\Business Office") addprinterconnection("\\wst2k03\WST - Phaser - 8400") CASE InGroup ("WESTSIDETEAM\Admissions") addprinterconnection("\\wst2k03\WST - Phaser - 8400") CASE InGroup ("WESTSIDETEAM\Admin") addprinterconnection("\\wst2k03\WST - Phaser - 8400") CASE InGroup ("WESTSIDETEAM\Activities") addprinterconnection("\\wst2k03\WST - Phaser - 8400")
; CASE InGroup ("North") ; CASE InGroup ("Rehab") ; CASE InGroup ("Business Office") ; CASE InGroup ("Etc...Etc...Etc")
ENDSELECT addprinterconnection("\\wst2k03\WST - BO - LJ4200") addprinterconnection("\\wst2k03\WST - DON - LJ2100") addprinterconnection("\\wst2k03\WST - Care - LJ4200") addprinterconnection("\\turennebkup\WST - WEST - LJ1300n") addprinterconnection("\\turennebkup\WST - NORTH - LJ1300n") addprinterconnection("\\turennebkup\WST - MED - LJ1300n") addprinterconnection("\\turennebkup\WST - SOUTH - LJ1300n") ;*****end WESTSIDETEAM section and stop script*********************
goto END
:PMCOTEAM ;*****map network drives****************************************** If InGroup ("Domain Users") USE "*" /DELETE EndIf ;*****delete all printers to clear out old printer mappings******* deltree("HKEY_CURRENT_USER\Printers\Connections") ;*****add these current printers back***************************** ; SELECT ; CASE InGroup ("1st Hall") ; CASE InGroup ("2nd Hall") ; CASE InGroup ("3rd Hall") ; CASE InGroup ("4th Hall") ; CASE InGroup ("5th Hall") ; CASE InGroup ("Business Office") ; CASE InGroup ("Etc...Etc...Etc") ; ENDSELECT addprinterconnection ("\\TURENNEBKUP\MHC - Office - Savin9922") addprinterconnection ("\\TURENNEBKUP\CHC - BO - LJ1200") addprinterconnection ("\\TURENNEBKUP\WST - BO - LJ4200") addprinterconnection ("\\TURENNEBKUP\PMCO - Reception - Savin2535") ;*****end PMCOTEAM section and stop script*********************
goto END :END
MESSAGEBOX("Your printers and drives have been mapped", "Networking Status", 64)
_________________________
Jason A King
|
Top
|
|
|
|
#119445 - 2004-05-12 11:09 PM
Re: Is Script OK?
|
Kdyer
KiX Supporter
![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif)
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Jason,
Cleaned up your code a bit.. Code:
SetConsole("SHOW")
; - COMMON SCRIPT COMPONENTS USE "*" /delete ;*****delete all printers to clear out old printer mappings******* $rc=deltree("HKEY_CURRENT_USER\Printers\Connections")
SELECT CASE @ldomain="TURENNETEAM" TURENNETEAM ENDSCRIPT CASE @ldomain="MCGUFFEYTEAM" MCGUFFEYTEAM ENDSCRIPT CASE @ldomain="CAPITOLHILLTEAM" CAPITOLHILLTEAM ENDSCRIPT CASE @ldomain="WESTSIDETEAM" WESTSIDETEAM ENDSCRIPT CASE @ldomain="PMCOTEAM" PMCOTEAM ENDSCRIPT CASE 1 "You are not a part of a domain" SLEEP 2 ENDSCRIPT ENDSELECT
FUNCTION turenneteam ;*****map network drives****************************************** USE P: "\\TURENNE-NAS1\HO\NETDRIVE" ;*****add these current printers back***************************** $rc=addprinterconnection ("\\TURENNEMSTR\HO - Savin2535") $rc=addprinterconnection ("\\TURENNEMSTR\HO - LJ2200") $rc=addprinterconnection ("\\TURENNEBKUP\CHC - BO - LJ1200") $rc=addprinterconnection ("\\TURENNEBKUP\CHC - Payroll - LJ2200") $rc=addprinterconnection ("\\TURENNEBKUP\MHC - Office - Savin9922") $rc=addprinterconnection ("\\TURENNEBKUP\MHC - BO - LJ4050") $rc=addprinterconnection ("\\TURENNEBKUP\WST - BO - LJ4200") $rc=addprinterconnection ("\\TURENNEBKUP\WST - DON - LJ2200") ;*****end TURENNETEAM section and stop script********************* ENDFUNCTION
FUNCTION mcguffeyteam ;*****map network drives****************************************** USE P: "\\MHC2K02\NETDRIVE" ;*****add these current printers back***************************** ; SELECT ; CASE InGroup ("1st Hall") ; CASE InGroup ("2nd Hall") ; CASE InGroup ("3rd Hall") ; CASE InGroup ("4th Hall") ; CASE InGroup ("5th Hall") ; CASE InGroup ("Business Office") ; CASE InGroup ("Etc...Etc...Etc") ; ENDSELECT $rc=addprinterconnection ("\\TURENNEBKUP\MHC - Office - Savin9922") $rc=addprinterconnection ("\\TURENNEBKUP\MHC - BO - LJ4050") $rc=addprinterconnection ("\\TURENNEBKUP\MHC - 2ndHall - LJ4Plus") $rc=addprinterconnection ("\\TURENNEBKUP\MHC - Dietary - LJ2300") $rc=addprinterconnection ("\\TURENNEBKUP\MHC - Payroll - LJ2200") $rc=addprinterconnection ("\\TURENNEBKUP\MHC - 4thHall - LJ1300N") ;*****end MCGUFFEYTEAM section and stop script********************* ENDFUNCTION
FUNCTION capitolhillteam ;*****map network drives****************************************** USE P: "\\CHC2K01\NETDRIVE" ;*****add these current printers back***************************** ; SELECT ; CASE InGroup ("One North") ; CASE InGroup ("Two North") ; CASE InGroup ("Three North") ; CASE InGroup ("Two South") ; CASE InGroup ("Three South") ; CASE InGroup ("Business Office") ; CASE InGroup ("Etc...Etc...Etc") ; ENDSELECT $rc=addprinterconnection ("\\TURENNEBKUP\CHC - 1West - LJ1300N") $rc=addprinterconnection ("\\TURENNEBKUP\CHC - 2North - LJ1300N") $rc=addprinterconnection ("\\TURENNEBKUP\CHC - 2South - LJ1300N") $rc=addprinterconnection ("\\TURENNEBKUP\CHC - 3North - LJ1300N") $rc=addprinterconnection ("\\TURENNEBKUP\CHC - 3South - LJ1300N") $rc=addprinterconnection ("\\TURENNEBKUP\CHC - BO - LJ1200") $rc=addprinterconnection ("\\TURENNEBKUP\CHC - HR - LJ1300N") $rc=addprinterconnection ("\\TURENNEBKUP\CHC - OneWest - LJ4050") $rc=addprinterconnection ("\\TURENNEBKUP\CHC - Payroll - LJ2200") $rc=addprinterconnection ("\\TURENNEBKUP\CHC - Rehab1 - LJ1300N") $rc=addprinterconnection ("\\TURENNEBKUP\CHC - RehabDirector - DJ845c") $rc=addprinterconnection ("\\TURENNEBKUP\CHC - 1West - LJ1300N") $rc=addprinterconnection ("\\TURENNEBKUP\CHC - Reception - Phaser850N") ;*****end CAPITOLHILLTEAM section and stop script********************* ENDFUNCTION
FUNCTION westsideteam ;*****map network drives****************************************** USE F: "\\wst2k03\file-server-data" USE G: "\\wst2k03\NetApps" USE H: "\\wst2k03\Users\@userid" USE S: "\\wst2k03\Depts" ;*****add these current printers back***************************** SELECT CASE InGroup ("WESTSIDETEAM\Business Office") $rc=addprinterconnection("\\wst2k03\WST - Phaser - 8400") CASE InGroup ("WESTSIDETEAM\Admissions") $rc=addprinterconnection("\\wst2k03\WST - Phaser - 8400") CASE InGroup ("WESTSIDETEAM\Admin") $rc=addprinterconnection("\\wst2k03\WST - Phaser - 8400") CASE InGroup ("WESTSIDETEAM\Activities") $rc=addprinterconnection("\\wst2k03\WST - Phaser - 8400")
; CASE InGroup ("North") ; CASE InGroup ("Rehab") ; CASE InGroup ("Business Office") ; CASE InGroup ("Etc...Etc...Etc") ENDSELECT $rc=addprinterconnection("\\wst2k03\WST - BO - LJ4200") $rc=addprinterconnection("\\wst2k03\WST - DON - LJ2100") $rc=addprinterconnection("\\wst2k03\WST - Care - LJ4200") $rc=addprinterconnection("\\turennebkup\WST - WEST - LJ1300n") $rc=addprinterconnection("\\turennebkup\WST - NORTH - LJ1300n") $rc=addprinterconnection("\\turennebkup\WST - MED - LJ1300n") $rc=addprinterconnection("\\turennebkup\WST - SOUTH - LJ1300n") ;*****end WESTSIDETEAM section and stop script********************* ENDFUNCTION
FUNCTION pmcoteam ;*****add these current printers back***************************** ; SELECT ; CASE InGroup ("1st Hall") ; CASE InGroup ("2nd Hall") ; CASE InGroup ("3rd Hall") ; CASE InGroup ("4th Hall") ; CASE InGroup ("5th Hall") ; CASE InGroup ("Business Office") ; CASE InGroup ("Etc...Etc...Etc") ; ENDSELECT $rc=addprinterconnection ("\\TURENNEBKUP\MHC - Office - Savin9922") $rc=addprinterconnection ("\\TURENNEBKUP\CHC - BO - LJ1200") $rc=addprinterconnection ("\\TURENNEBKUP\WST - BO - LJ4200") $rc=addprinterconnection ("\\TURENNEBKUP\PMCO - Reception - Savin2535") ;*****end PMCOTEAM section and stop script********************* ENDFUNCTION
FUNCTION endscript MESSAGEBOX("Your printers and drives have been mapped", "Networking Status", 64) ENDFUNCTION
HTH,
Kent
|
Top
|
|
|
|
#119446 - 2004-05-12 11:37 PM
Re: Is Script OK?
|
Sardis
Fresh Scripter
Registered: 2004-01-16
Posts: 28
Loc: Montgomery, AL
|
What does the $rc variable accomlish. Can you not just put addprinterconnection on one line?
_________________________
Jason A King
|
Top
|
|
|
|
#119447 - 2004-05-12 11:46 PM
Re: Is Script OK?
|
Kdyer
KiX Supporter
![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif)
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
It is called a returncode.. It suppresses the 1's and 0's you see during script execution.
Kent
|
Top
|
|
|
|
#119448 - 2004-05-12 11:49 PM
Re: Is Script OK?
|
ShaneEP
MM club member
![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif)
Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
|
|
Top
|
|
|
|
#119450 - 2004-05-13 05:53 PM
Re: Is Script OK?
|
Sardis
Fresh Scripter
Registered: 2004-01-16
Posts: 28
Loc: Montgomery, AL
|
Quote:
eh? it looks to me they are all on one line.
eh? It looks to me like they are all on seperate lines.
_________________________
Jason A King
|
Top
|
|
|
|
#119451 - 2004-05-13 05:56 PM
Re: Is Script OK?
|
ShaneEP
MM club member
![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif)
Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
|
Code:
$rc=addprinterconnection ("\\TURENNEMSTR\HO - Savin2535")
Looks like separate lines to you? Maybe you have some different meaning of the word line?
|
Top
|
|
|
|
#119453 - 2004-05-13 08:34 PM
Re: Is Script OK?
|
Kdyer
KiX Supporter
![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif)
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Quote:
Get over yourselves. Really.
Remember, we are volunteers here taking the time out of the work day to help. If there is more than one response to your question - it is usually a different perspective or even how to do it better.
Kent
|
Top
|
|
|
|
#119454 - 2004-05-13 09:45 PM
Re: Is Script OK?
|
ShaneEP
MM club member
![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif)
Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
|
Quote:
What does the $rc variable accomlish. Can you not just put addprinterconnection on one line?
Maybe we just mis-understood your question. Not sure what you mean by putting the addprinterconnection on one line..When it already is only one line. Do you mean like adding multiple printers with one addprintconnection? If that is what you're wanting to know, then I dont believe so...Unless someone else can say differently.
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 132 anonymous users online.
|
|
|