#136026 - 2005-03-21 10:53 PM
isinsubnet
|
dbortunk
Fresh Scripter
Registered: 2001-05-18
Posts: 36
Loc: USA
|
I am trying to figure out the syntax for isinsubnet. I curently have
$IPAddress=@IPADDRESS0 $NetworkID='172.28.54.0' $SubnetMask='255.255.254.0' if IsInSubnet($IPAddress,$NetworkID,$SubnetMask)
But I need to add about 5 subnets and then write a script to check which subnet the useris in and run a script off it? What would the syntax be?
If $Answer=?
Thanks
|
|
Top
|
|
|
|
#136027 - 2005-03-21 11:48 PM
Re: isinsubnet
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Did you look at the Docs for this?
Are you running KiXtart 4.21 or better?
The examples provided should help you along.
HTH,
Kent
|
|
Top
|
|
|
|
#136029 - 2005-03-22 01:03 AM
Re: isinsubnet
|
Bryce
KiX Supporter
   
Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
|
also Richards, IPDecimal() can return this information too.
Code:
Call 'g:\kix\udf\IPDecimal\IPDecimal.kix'
; Get primary NIC details $IP=EnumIPInfo(0,0) $Mask=EnumIPInfo(0,1)
; Calculate info $Network=IPDecimal($IP) & IPDecimal($Mask)
; Display it ? "This computer is on network: "+IPDecimal($Network)
|
|
Top
|
|
|
|
#136030 - 2005-03-22 02:09 AM
Re: isinsubnet
|
dbortunk
Fresh Scripter
Registered: 2001-05-18
Posts: 36
Loc: USA
|
i am running 4.21 and i read the examples but i can't figure out from the examples how I would go about having different outputs for different subnets
|
|
Top
|
|
|
|
#136033 - 2005-03-22 02:21 AM
Re: isinsubnet
|
dbortunk
Fresh Scripter
Registered: 2001-05-18
Posts: 36
Loc: USA
|
i need to execute an exe. But i only want it executed if the users come from either of two subnets and I have about 20 subnets
|
|
Top
|
|
|
|
#136035 - 2005-03-22 02:28 AM
Re: isinsubnet
|
dbortunk
Fresh Scripter
Registered: 2001-05-18
Posts: 36
Loc: USA
|
oh ok so that would work? I wasn't sure. But let's say that I needed to add more subnets every day, would i just continue to do he OR, or is there a more efficient way to do this
|
|
Top
|
|
|
|
#136037 - 2005-03-22 02:39 AM
Re: isinsubnet
|
dbortunk
Fresh Scripter
Registered: 2001-05-18
Posts: 36
Loc: USA
|
Select Case IsInSubnet(@IPADDRESS0,'172.28.54.0','255.255.254.0') Case IsInSubnet (@IPADDRESS0,'192.168.111.0','255.255.255.0') Case etc.... EndSelect
like that?
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(mole)
and 1300 anonymous users online.
|
|
|