#70422 - 2002-10-01 12:19 AM
inventory for certain peeps on certain classC
|
Manimal
Getting the hang of it
Registered: 2000-04-04
Posts: 96
Loc: Oregon City, OR. USA
|
I've got an inventory script - which is still a work in progress - that I want to only run for a user if they are in their native network.
For example. UserA belongs to DeptA and roams between offices A, B, and C which all have their own ClassC subnets. User A could also visit and work from office D which belongs to a diff department. Right now the inventory script would run at login and I'd get an entry for a machine belonging to DeptB in Dept A's area.
I need the script to identify the classC of the current station (already done), department which the person belongs to (done via PrimaryGroup), and only run the inventory piece if the class C matches a valid entry for that department.
I was thinking of using an array or a select statement of valid Class C's for each department but I've got 40 departments to deal with.
Can anyone think of an easy way to organize this? If you need more description let me know.
Thanks, Chris
_________________________
Chris Fricke Clackamas County
|
|
Top
|
|
|
|
#70426 - 2002-10-01 04:47 AM
Re: inventory for certain peeps on certain classC
|
Sealeopard
KiX Master
   
Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
|
|
|
Top
|
|
|
|
#70429 - 2002-10-01 05:03 AM
Re: inventory for certain peeps on certain classC
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Well I think that the hash (Associative Array, Dictionary Object) would be the best approach. The INI file work well too.
Pseudo Hash UDFs
Use my UDF CalcLogicalSubnet (IP, SNmask) or one of the others in the UDF Library to determine the logical subnet. (This is not necessary for just three subnets. But if your network grows and you start to allocate only a small number of addresses per location, this approach can grow with you.) [ 01. October 2002, 05:18: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#70433 - 2002-10-01 06:51 PM
Re: inventory for certain peeps on certain classC
|
Manimal
Getting the hang of it
Registered: 2000-04-04
Posts: 96
Loc: Oregon City, OR. USA
|
still running an old version of kix so the UDFthingy won't work.
Several departments have multiple class C's DeptA 10.32.1 10.32.2 10.32.3
DeptB 10.32.4
etc
so...
code:
:SetUniversalVars $oct1 = LTRIM(SUBSTR(@ipaddress0, 1, 3)) $oct2 = LTRIM(SUBSTR(@ipaddress0, 5, 3)) $oct3 = LTRIM(SUBSTR(@ipaddress0, 9, 3)) $classB = $oct1 + "." + $oct2 $classC = $oct1 + "." + $oct2 + "." + $oct3
:GroupDetect select case @primarygroup = "deptA" ;mapdrive, set vars, yaddayadda $arraytotal = 3 DIM $subnet[$arraytotal] $subnet[0] = 10.32.1 $subnet[1] = 10.32.2 $subnet[2] = 10.32.3 goto "techstuff" case @primarygroup = "deptB" ;mapdrive, set vars, yaddayadda $arraytotal = 1 DIM $subnet[$arraytotal] $subnet[0] = 10.32.4 goto "techstuff" case 1 endselect
:TechStuff ;--- inventory --- $nb = 0 DO if $ClassC = $subnet[$nb] call "inventory.kix" endif $nb = $nb + 1 UNTIL $nb = $arraytotal ;--- set email profiles, citrix setings, Ras detect, etc ---
Think that's simple enough?
Thanks, Chris [ 01. October 2002, 18:52: Message edited by: Manimal ]
_________________________
Chris Fricke Clackamas County
|
|
Top
|
|
|
|
#70438 - 2002-10-07 08:32 PM
Re: inventory for certain peeps on certain classC
|
Manimal
Getting the hang of it
Registered: 2000-04-04
Posts: 96
Loc: Oregon City, OR. USA
|
I will re do the array - much cleaner but I need to keep the $classC as it it referenced elsewhwere (several places actually) for different functions
thanks all - I love this place!
_________________________
Chris Fricke Clackamas County
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 1619 anonymous users online.
|
|
|