jslegers Posted February 16, 2010 Posted February 16, 2010 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?
99ojo Posted February 16, 2010 Posted February 16, 2010 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
Steveiwonder Posted February 16, 2010 Posted February 16, 2010 (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 Edited February 16, 2010 by Steveiwonder They call me MrRegExpMan
jslegers Posted February 16, 2010 Author Posted February 16, 2010 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 Thanks for the replies it works.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now