Jump to content

Recommended Posts

Posted

Hello,

I want to make a script that could check on ip address and then perform a installation.

Before I begin I want to know if this is possible.

I want some thing like :

If ip address is in range 10.10.10.1 to 10.10.10.255 than execute program a

If ip address is in range 10.10.20.1 to 10.10.20.255 than execute program b

Is this possible?

Posted

Hi,

one solution:

; keep in mind you might have more ipadresses defined on pc, look at @ipadress macro
;Split 1st Ip Adress into octets, don't return amount into 1 st element of array
$ipokt = StringSplit (@IPAddress1, ".", 2)
;check 3. rd octet
If Number ($ipokt [2]) < 20 Then
    ; execute program a
Else
    ;execute program b
EndIf

;-))

Stefan

Posted (edited)

I'm not gonna write the whole script for you, you can work out the rest.

If you have something already then post it here.

$IpAddress = @IPAddress1

$IpAddressSplit = StringSplit($IpAddress, ".", 2)

If $IpAddressSplit[2] = "10" Then

Edit: someone else wrote it for you :mellow:

Edited by Steveiwonder

They call me MrRegExpMan

Posted

I'm not gonna write the whole script for you, you can work out the rest.

If you have something already then post it here.

$IpAddress = @IPAddress1

$IpAddressSplit = StringSplit($IpAddress, ".", 2)

If $IpAddressSplit[2] = "10" Then

Edit: someone else wrote it for you :mellow:

Thanks for the replies it works.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...