#140218 - 2005-05-24 06:34 PM
Re: Assigning Printers by Geographical Location
|
maciep
Korg Regular
   
Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
|
That can definitely be done. Just as a start you could do something like
Code:
if left(@wksta,2) = 'FI' ; Finance Printer endif
And i know a lot of people base their printer mapping off of ini files, so you could step it up a notch and have an ini file like maybe
Printers.ini Code:
[FI] DefaultPrinter=TheFinancePrinter SecondaryPrinter=ABackupPrinterMaybe [EN] DefaultPrinter=TheEngineeringPrinter SecondaryPrinter=TheirBackupPrinter
And then in your script something like
Code:
$dept = left(@wksta,2) $defPrinter = readprofilestring("PathToIni",$dept,"DefaultPrinter") $secPrinter = readprofilestring("PathToIni",$dept,"SecondaryPrinter")
I'm sure others here can provide more (better?) suggestions...
|
|
Top
|
|
|
|
#140220 - 2005-05-24 07:12 PM
Re: Assigning Printers by Geographical Location
|
Huffinagle
Getting the hang of it
   
Registered: 2002-09-04
Posts: 75
Loc: McMinnville, OR, USA
|
Quote:
"Pedro, how do you feel about that one? That looks pretty sweet, that looks awesome, that script it's.... it's incredible....."
I haven't used ini files before, but that looks great. I'll start chewing on it and see if I can make it work. THANKS!
|
|
Top
|
|
|
|
#140223 - 2005-05-24 08:02 PM
Re: Assigning Printers by Geographical Location
|
Huffinagle
Getting the hang of it
   
Registered: 2002-09-04
Posts: 75
Loc: McMinnville, OR, USA
|
Quote:
That can definitely be done. Just as a start you could do something like
Code:
if left(@wksta,2) = 'FI' ; Finance Printer endif
And i know a lot of people base their printer mapping off of ini files, so you could step it up a notch and have an ini file like maybe
Printers.ini Code:
[FI] DefaultPrinter=TheFinancePrinter SecondaryPrinter=ABackupPrinterMaybe [EN] DefaultPrinter=TheEngineeringPrinter SecondaryPrinter=TheirBackupPrinter
And then in your script something like
Code:
$dept = left(@wksta,2) $defPrinter = readprofilestring("PathToIni",$dept,"DefaultPrinter") $secPrinter = readprofilestring("PathToIni",$dept,"SecondaryPrinter")
I'm sure others here can provide more (better?) suggestions...
maciep,
I have a question about your script:
You identify $defPrinter as readprofilestring("PathToIni",$dept,"DefaultPrinter").
Would I then use the $defPrinter variable like this: Code:
ADDPRINTERCONNECTION ("$defPrinter")
|
|
Top
|
|
|
|
#140225 - 2005-05-24 08:56 PM
Re: Assigning Printers by Geographical Location
|
Huffinagle
Getting the hang of it
   
Registered: 2002-09-04
Posts: 75
Loc: McMinnville, OR, USA
|
Okay.... I created a script that works. Please look it over and let me know if I need to modify how the script runs.
User logs in and runs logon.kix which makes the following call: Code:
CALL @SCRIPTDIR+'\printers.kix' ; This script assigns printers to client logon profiles.
The contents of printers.kix runs: Code:
$dept = left(@wksta,2) $1stPrinter = readprofilestring("\\data\netlogon\printers.ini",$dept,"1stPrinter") $2ndPrinter = readprofilestring("\\data\netlogon\printers.ini",$dept,"2ndPrinter") $3ndPrinter = readprofilestring("\\data\netlogon\printers.ini",$dept,"3ndPrinter") IF AddPrinterConnection ($1stPrinter) = 0 ? "Added printer connection...." ENDIF
Which parses the printers.ini: Code:
[AB] 1stPrinter=\\DATA\FDAMBLJ 2NDPRINTER=\\DATA\FDADMINLJ 3RDPRINTER=\\DATA\FDCOLORLJ
[AQ] 1STPRINTER=\\DATA\AQOFFICELJ 2NDPRINTER=\\DATA\AQCOLORLJ
[BU]
[CC] 1STPRINTER=\\DATA\CCADMINLJ 2NDPRINTER=\\DATA\CCOFFICELJ etc.........
My end result being: Printers are added to computers according to their departments. If the printer exists, the process is aborted.
Any corrections are appreciated.
Thanks, Matt
Edited by Huffinagle (2005-05-24 11:02 PM)
|
|
Top
|
|
|
|
#140227 - 2005-05-24 10:45 PM
Re: Assigning Printers by Geographical Location
|
Huffinagle
Getting the hang of it
   
Registered: 2002-09-04
Posts: 75
Loc: McMinnville, OR, USA
|
Thanks for catching that. Here's an updated Code:
Code:
$dept = left(@wksta,2) $1stPrinter = readprofilestring("\\city1\netlogon\printers.ini",$dept,"1stPrinter") $2ndPrinter = readprofilestring("\\city1\netlogon\printers.ini",$dept,"2ndPrinter") $3ndPrinter = readprofilestring("\\city1\netlogon\printers.ini",$dept,"3ndPrinter") IF AddPrinterConnection ($1stPrinter) = 0 ? "Added printer connection...." ENDIF IF AddPrinterConnection ($2ndPrinter) = 0 ? "Added printer connection...." ENDIF IF AddPrinterConnection ($3rdPrinter) = 0 ? "Added printer connection...." ENDIF
|
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|