#143183 - 2005-07-07 04:10 PM
Printer mapping using ascan
|
puck5151
Fresh Scripter
Registered: 2002-05-08
Posts: 11
|
Hi, having difficulties with the following script...
;Map HP12whse Printer $SystemList = 'terminalserver','testserver','dbserver3','printserver'," If AScan ($SystemList, @WKSTA)>=0 ;Do nothing Else IF INGROUP("HP12whse") If AddPrinterConnection ("\\printserver\HP12whse") = 0 ? "Attach network printer \\printserver\HP12whse" Endif EndIf
Everything looks good but hangs up as soon as it hits "if ingroup".
Thanks.
|
|
Top
|
|
|
|
#143184 - 2005-07-07 04:53 PM
Re: Printer mapping using ascan
|
Bryce
KiX Supporter
   
Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
|
Code:
;Map HP12whse Printer $SystemList = 'terminalserver','testserver','dbserver3','printserver' ;<--- there was an extra ," at the end of this line If AScan ($SystemList, @WKSTA) = -1 ;<--- changed this line to check for ascan returning a -1, not in array, making the IF TRUE IF INGROUP("HP12whse") If AddPrinterConnection ("\\printserver\HP12whse") = 0 ? "Attach network printer \\printserver\HP12whse" Endif endif ;<--- you were missing an ENDIF EndIf
|
|
Top
|
|
|
|
#143185 - 2005-07-07 05:06 PM
Re: Printer mapping using ascan
|
puck5151
Fresh Scripter
Registered: 2002-05-08
Posts: 11
|
Worked like a charm, thanks Bryce.
|
|
Top
|
|
|
|
#143186 - 2005-07-07 05:58 PM
Re: Printer mapping using ascan
|
puck5151
Fresh Scripter
Registered: 2002-05-08
Posts: 11
|
Bryce, I would like to exclude the servers listed in the ascan from mapping the printers, any thoughts?
Thanks.
|
|
Top
|
|
|
|
#143188 - 2005-07-07 06:09 PM
Re: Printer mapping using ascan
|
puck5151
Fresh Scripter
Registered: 2002-05-08
Posts: 11
|
That's what I thought but then I added one of my servers and logged in to test and it mapped all printers.
|
|
Top
|
|
|
|
#143189 - 2005-07-07 06:31 PM
Re: Printer mapping using ascan
|
puck5151
Fresh Scripter
Registered: 2002-05-08
Posts: 11
|
It appears that the ascan is being ignored?
|
|
Top
|
|
|
|
#143191 - 2005-07-07 07:27 PM
Re: Printer mapping using ascan
|
Bryce
KiX Supporter
   
Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
|
Quote:
It appears that the ascan is being ignored?
you changed the code? if so repost it please.
|
|
Top
|
|
|
|
#143192 - 2005-07-07 11:00 PM
Re: Printer mapping using ascan
|
puck5151
Fresh Scripter
Registered: 2002-05-08
Posts: 11
|
Here's the code...
;Map HP12whse Printer $SystemList= 'terminalserver','dbserver3','printserver','mainfileserver','SBCS' AScan ($SystemList, @WKSTA) = -1 IF INGROUP("HP12WHSE") If AddPrinterConnection ("\\printserver\HP12WHSE") = 0 ? "Attach network printer \\printserver\HP12WHSE" Endif endif
The code would not accept another endif at the end.
|
|
Top
|
|
|
|
#143195 - 2005-07-08 10:17 PM
Re: Printer mapping using ascan
|
puck5151
Fresh Scripter
Registered: 2002-05-08
Posts: 11
|
Sorry, my bad. As soon as I added the IF expression it worked perfectly. Thanks for noticing that in the code.
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
1 registered
(mole)
and 1300 anonymous users online.
|
|
|