#162556 - 2006-05-28 02:19 PM
Help!
|
TJ_Adams
Fresh Scripter
Registered: 2006-05-25
Posts: 7
|
if fnINGROUP("Admin 4200") = 0 addprinterconnection("\\Corp\Exec HP 4200") endif
if fnINGROUP("Canon") = 0 addprinterconnection("\\Corp\CSRS_CanoniR5") endif
if fnINGROUP("Color 1320") = 0 addprinterconnection("\\Corp\ColorAnalyst") endif
if fnINGROUP("HP 2430") = 0 addprinterconnection("\\Corp\HP2430Mailing") endif
if fnINGROUP("HP 8000") = 0 addprinterconnection("\\Corp\Estimating") endif
if INGROUP("HP 8500") = 0 addprinterconnection("\\Corp\HPColor_preflight") endif
if INGROUP("HP LJ 6MP") = 0 addprinterconnection("\\Corp\LJet6mp") endif
if fnINGROUP("Kyocera") = 0 addprinterconnection("\\Corp\Planning_5035") endif
if fnINGROUP("Planning Samsung") = 0 addprinterconnection("\\Corp\ML-1650") endif
if fnINGROUP("Sheetfed 1320") = 0 addprinterconnection("\\Corp\Sheetfed") endif
if fnINGROUP("Shipping 1320") = 0 addprinterconnection("\\Corp\Shipping") endif
if fnINGROUP("Web 1320") = 0 addprinterconnection("\\Corp\WebHP") endif
;SET DEFAULT
if fnINGROUP("Canon") = 1 SETDEFAULTPRINTER("\\Corp\Canon iR5000-6000 PCL6") endif
if fnINGROUP("HP 8000") = 1 SETDEFAULTPRINTER("\\Corp\HP LaserJet 8000 Series PS") endif
if fnINGROUP("HP LJ 6MP") = 1 SETDEFAULTPRINTER("\\Corp\HP LaserJet 6P/6MP PostScript") endif
if fnINGROUP("Sheetfed 1320") = 1 SETDEFAULTPRINTER("\\Corp\Sheetfed Laserjet1320") endif
if fnINGROUP("Shipping 1320") = 1 SETDEFAULTPRINTER("\\Corp\Shipping 1320N") endif
if fnINGROUP("Shipping 1320") = 1 SETDEFAULTPRINTER("\\Corp\Web HP 1320N") endif
|
|
Top
|
|
|
|
#162558 - 2006-05-28 02:29 PM
Re: Help!
|
TJ_Adams
Fresh Scripter
Registered: 2006-05-25
Posts: 7
|
We are changing our IP addressing scheme and I want a script to add printers by AD group and set default for some. Someone used fnINGROUP and I stole, I don't recall where I saw it. Bad code is the only way to explain the 1 and 0
Edited by TJ_Adams (2006-05-28 02:31 PM)
|
|
Top
|
|
|
|
#162560 - 2006-05-28 04:26 PM
Re: Help!
|
TJ_Adams
Fresh Scripter
Registered: 2006-05-25
Posts: 7
|
The problem is that the script doesn't work. It add all printers instead of just the ones associated witht the group.
|
|
Top
|
|
|
|
#162562 - 2006-05-28 04:35 PM
Re: Help!
|
TJ_Adams
Fresh Scripter
Registered: 2006-05-25
Posts: 7
|
Like I said I stole it, so I am probably not using it correctly. I am assuming "fn" refers to something outside the script correct? If that is the case I do not have it
|
|
Top
|
|
|
|
#162565 - 2006-05-28 04:46 PM
Re: Help!
|
TJ_Adams
Fresh Scripter
Registered: 2006-05-25
Posts: 7
|
Because I am not sure what I am doing? I removed "fn" and the script adds 5 printers when it should only add one
|
|
Top
|
|
|
|
#162566 - 2006-05-28 04:53 PM
Re: Help!
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
Does this work as expected (untested):
Code:
if INGROUP("Admin 4200") $= addprinterconnection("\\Corp\Exec HP 4200") endif
if INGROUP("Canon") $= addprinterconnection("\\Corp\CSRS_CanoniR5") endif
if INGROUP("Color 1320") $= addprinterconnection("\\Corp\ColorAnalyst") endif
if INGROUP("HP 2430") $= addprinterconnection("\\Corp\HP2430Mailing") endif
if INGROUP("HP 8000") $= addprinterconnection("\\Corp\Estimating") endif
if INGROUP("HP 8500") $= addprinterconnection("\\Corp\HPColor_preflight") endif
if INGROUP("HP LJ 6MP") $= addprinterconnection("\\Corp\LJet6mp") endif
if INGROUP("Kyocera") $= addprinterconnection("\\Corp\Planning_5035") endif
if INGROUP("Planning Samsung") $= addprinterconnection("\\Corp\ML-1650") endif
if INGROUP("Sheetfed 1320") $= addprinterconnection("\\Corp\Sheetfed") endif
if INGROUP("Shipping 1320") $= addprinterconnection("\\Corp\Shipping") endif
if INGROUP("Web 1320") $= addprinterconnection("\\Corp\WebHP") endif
;SET DEFAULT
if INGROUP("Canon") $= SETDEFAULTPRINTER("\\Corp\Canon iR5000-6000 PCL6") endif
if INGROUP("HP 8000") $= SETDEFAULTPRINTER("\\Corp\HP LaserJet 8000 Series PS") endif
if INGROUP("HP LJ 6MP") $= SETDEFAULTPRINTER("\\Corp\HP LaserJet 6P/6MP PostScript") endif
if INGROUP("Sheetfed 1320") $= SETDEFAULTPRINTER("\\Corp\Sheetfed Laserjet1320") endif
if INGROUP("Shipping 1320") $= SETDEFAULTPRINTER("\\Corp\Shipping 1320N") endif
if INGROUP("Shipping 1320") $= SETDEFAULTPRINTER("\\Corp\Web HP 1320N") endif
|
|
Top
|
|
|
|
#162567 - 2006-05-28 04:58 PM
Re: Help!
|
TJ_Adams
Fresh Scripter
Registered: 2006-05-25
Posts: 7
|
yes it does my version also works with fn removed and everything set to =1 What is the difference between the 2?
|
|
Top
|
|
|
|
#162568 - 2006-05-28 05:02 PM
Re: Help!
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
INGROUP() is a function that is already built into Kixtart. fnINGROUP() is unknown to Kixtart - so Kixtart assumes your trying to call a custom function that YOU wrote ... it would look like this:
Code:
Function fnINGROUP($name)
; Your function code here
EndFunction
The checking for 1 versus nothing is no big deal ... INGROUP returns a 1 which is a boolean TRUE, so you dont really (really) need the =1 bit. Just a style thing.
|
|
Top
|
|
|
|
#162569 - 2006-05-28 05:07 PM
Re: Help!
|
TJ_Adams
Fresh Scripter
Registered: 2006-05-25
Posts: 7
|
Great, thanks for your help
|
|
Top
|
|
|
|
#162571 - 2006-05-29 05:26 PM
Re: Help!
|
Gargoyle
MM club member
   
Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
|
Quote:
InGroup( )
Action: Checks whether the current user is a member of a group. Syntax: INGROUP ("group name" [<,> "group name 2"], mode) Parameters: Group name, group name 2, group name X… Identifies the group(s) in which to check the user's membership. You may pass multiple group names as arguments -or- a single array who's element(s) are the names of one or more groups to test. Note: This function does not currently support passing multiple arrays as arguments.
Mode
Optional integer parameter indicating whether or not InGroup checks for group membership of one or all groups in the list (default = 0). Possible values:
0 InGroup checks for membership of ONE of the groups in the list (default) 1 InGroup checks for membership of ALL of the groups in the list Remarks: INGROUP can be used to check for groupmembership of groups that exist on the domain or server where the user is logged on, or to check for groupmembership of groups on a specific domain or server. When checking for a local group, INGROUP identifies that the user is indirectly a member of the group by virtue of being a member of a global group which, in turn, is a member of the local group.
If you want to check for membership in a group on a specific domain or server, use the following format:
"OtherDomain\group" –or– "\\SomeServer\group"
For Windows 9x clients, INGROUP works on local groups only if the KiXtart RPC service is running. Returns: 0 The user is not a member of a group with this name 1 The user is a member of a global group with this name See Also: EnumGroup( ), EnumLocalGroup( ), Group Membership Information Examples: If InGroup("Domain Users") DISPLAY "z:\users.txt" EndIf
If InGroup("Developers", "Testers") = 1 ? "Member of Developers OR Testers group" EndIf
If InGroup("Developers", "Testers", 1) = 1 ? "Member of Developers AND Testers group" EndIf
$Array = "Developers", "Testers" If InGroup($Array, 1) = 1 ? "Member of Developers AND Testers group" EndIf
If InGroup("\\" + @WKSTA + "\Developers") = 1 ? "Member of Developers on local system" EndIf
By reading the manual you find that If a user is "NOT" a member of the group {if fnINGROUP("HP 2430") = 0} then it would map that printer for them.
_________________________
Today is the tomorrow you worried about yesterday.
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 1179 anonymous users online.
|
|
|