#159006 - 2006-03-14 05:05 PM
A More Automated addprinterconnection() Approach
|
hoopes
Fresh Scripter
Registered: 2006-03-02
Posts: 33
|
Greetings,
Is there a way to have a kixtart script:
1. Traverse through ALL installed printers on a print server, determine its security permissions, and store its info in a array?
2. Compare those printer security permissions to a user utilizing the ingroup() function? Ultimately, if a user matches any of the security permissions of each printer, it will be dealt with accordingly. Of course this would all occur in some sort of for or while loop to traverse each printer.
3. Finally, utilize the addprinterconnection() function to finally add a user's printers. Of course this would all be done dynamically.
The benefits of this: 1. If we need to add a printer, we don't need to edit any kixtart scripts (Requires less training). 2. It's easier. 3. I'll sleep better at nights 4. It will probably cut my code in half (We're talking over 1000 lines).
Thanks in advance!!!
Hoopes
|
Top
|
|
|
|
#159007 - 2006-03-14 05:14 PM
Re: A More Automated addprinterconnection() Approach
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
make a global group, example "PrinterA"
assign users to that group
in your script: if ingroup('PrinterA') $nul=addprinterconnection('\\server\printera') endif
|
Top
|
|
|
|
#159013 - 2006-03-14 07:46 PM
Re: A More Automated addprinterconnection() Approach
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
I think you should review the following thread. I think it pertains to some of the issues you are encountering. Some of the discussion throughout the thread may be directly applicable to your situation.
http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=104500
|
Top
|
|
|
|
#159016 - 2006-03-15 05:34 PM
Re: A More Automated addprinterconnection() Approach
|
hoopes
Fresh Scripter
Registered: 2006-03-02
Posts: 33
|
OK, I just realized this is going to be a bit more complicated. Here's what I need to do:
1. (FIRST for-loop): Query ALL of the GLOBAL groups that start with glbl_grp_* (Please note * is a wildcard) from @USERID when they login and dump the results into an array called $USR_GLOBAL_GRPS[$i].
2. (INSIDE FIRST for-loop (SECOND for-loop)): Query all of the corresponding DOMAIN LOCAL groups that contain dmlcl_grp_*_printers from $USR_GLOBAL_GRPS[$i] (Please note * is a wildcard) and dump the results into an array called $USR_PRINTER_PERMS[$j].
3. (INSIDE FIRST for-loop (THIRD for-loop)): Query ALL of the installed printers on the print server and determine what their NAMES are and what DOMAIN LOCAL groups contain dmlcl_grp_*_printers. Dump those results into two arrays; an array called $CURRENT_PRINTER[$k] and an array called $PRINTER_PERMS[$l].
3. (inside FIRST for-loop (FOURTH for-loop)) Once our two arrays ($USR_PRINTER_PERMS[$j] and $PRINTER_PERMS[$l]) have been populated, start traversing and comparing both arrays
4. (INSIDE FOURTH for-loop (If-statement)): If any one of the printer's DOMAIN LOCAL groups inside the $USR_PRINTER_PERMS[$j] array match any one of the DOMAIN LOCAL groups inside the $PRINTER_PERMS[$l] array, use the addprinterconnection($CURRENT_PRINTER[$k]) function to add the printer to the @USERID logging in.
Please note that I am attempting to eliminate hard-coding username's groups and printers (With the exception of the naming convention dmlcl_grp_*_printers and glbl_grp_* used to populate the arrays).
Also could someone please shoot me some sort of code to start with, because I'm having a hell of a time with this . Thanks in advance!
Hoopes
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 980 anonymous users online.
|
|
|