#187446 - 2008-05-02 08:45 PM
filtering out machine before adding the users to the printers
|
Tony
Getting the hang of it
Registered: 2001-11-04
Posts: 55
Loc: LA
|
Hey,
I neeed help with the syntax for filtering out the machines before adding the printers.
We are deploying printers to users via Windows AD (GPO). I want to filter out 3 terminal servers that should not apply to the script (the rest of the machines are fine). I don' have the luxury to move my computer/user around in the OU (also we are deploying via User Object in that GPO).
For example,
If manchine name <> terminal1, terminal2, terminal3, then do the following
If @UserID = bob
AddPrinterConnection("\\lnx1\Brother_8860")
delPrinterConnection("\\lnx1\hp4000")
SetDefaultPrinter("\\lnx1\Brother_8860")
EndIf
If @UserID = jdole
delPrinterConnection("\\ps1\Brother_8860")
AddPrinterConnection("\\lnx1\hp4000")
AddPrinterConnection("\\lnx1\Brother_8860")
SetDefaultPrinter("\\lnx1\hp4000")
EndIf
End if
TIA, -tt
Edited by NTDOC (2008-05-02 09:42 PM) Edit Reason: Added code tags and formatting
|
|
Top
|
|
|
|
#187453 - 2008-05-03 01:02 AM
Re: filtering out machine before adding the users to the printers
[Re: Gargoyle]
|
Tony
Getting the hang of it
Registered: 2001-11-04
Posts: 55
Loc: LA
|
Thanks a lot.
I will try it and report back.
Tt
|
|
Top
|
|
|
|
#187470 - 2008-05-06 01:03 AM
Re: filtering out machine before adding the users to the printers
[Re: Gargoyle]
|
Tony
Getting the hang of it
Registered: 2001-11-04
Posts: 55
Loc: LA
|
Gargoyle,
I tested and I think you misread my post. Shouldn't it be -1 since I don't want the servers listed on the array to run if users are logging in ?
$TSList = "Terminal1,"Terminal2","Terminal3" If AScan($TSList,@WKSTA) >-1 Do Stuff EndIf
TIA, tt
|
|
Top
|
|
|
|
#187491 - 2008-05-06 07:25 PM
Re: filtering out machine before adding the users to the printers
[Re: Gargoyle]
|
Tony
Getting the hang of it
Registered: 2001-11-04
Posts: 55
Loc: LA
|
Thanks for your reply.
For something like this below, do I need any other syntax, such as @echo off, etc..? So far it works.
TIA, tt ;*********************************************************** $TSList = "terminal1", "test3", "test1", "test2"
If AScan($TSList,@WKSTA) =-1
If @UserID = joeca AddPrinterConnection("\\vmad2\lexmark") AddPrinterConnection("\\vmad2\canon4") delPrinterConnection("\\vmad2\hp4000") SetDefaultPrinter("\\vmad2\canon4") EndIf
If @userID = bob ;delprinterconnection("\\vmad2\canon4") addprinterconnection("\\vmad2\canon4") addprinterconnection("\\vmad2\hp7000") setdefaultPrinter("\\vmad2\hp7000") Endif
If @UserID = jdole delPrinterConnection("\\ps1\Brother_8860") AddPrinterConnection("\\lnx1\hp4000") AddPrinterConnection("\\lnx1\Brother_8860") SetDefaultPrinter("\\lnx1\hp4000") EndIf
EndIf
Edited by Tony (2008-05-06 07:26 PM)
|
|
Top
|
|
|
|
#187516 - 2008-05-07 11:11 PM
Re: filtering out machine before adding the users to the printers
[Re: Mart]
|
Tony
Getting the hang of it
Registered: 2001-11-04
Posts: 55
Loc: LA
|
Mart,
Thanks for the code. The one I posted is just to confused?
Thanks, Tt
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1057 anonymous users online.
|
|
|