jezr74 Posted October 6, 2005 Share Posted October 6, 2005 Hi there, I'm having trouble working out a way to determine what subnet a script is running on, in which depending on the subnet it will perform different functions. $LocalIP=@IPAddress1 if $LocalIP = "192.168.1." then IniWrite("C:\Program Files\Info\xp.ini", "XP", "Site", "Office1") if $LocalIP = "192.168.2." then IniWrite("C:\Program Files\Info\xp.ini", "XP", "Site", "Office2") if $LocalIP = "192.168.3." then IniWrite("C:\Program Files\Info\xp.ini", "XP", "Site", "Office3") if $LocalIP = "192.168.4." then IniWrite("C:\Program Files\Info\xp.ini", "XP", "Site", "Office4") $Site=IniRead("C:\Program Files\Info\xp.ini", "XP", "Site", "NOT FOUND") The above does'nt work... I can make it work with > , but can prove unreliable. I'm not sure how to make it check a range of IPS... Any guidance would be great... thanks Link to comment Share on other sites More sharing options...
jefhal Posted October 6, 2005 Share Posted October 6, 2005 Any guidance would be great...thanksCheck out stringinstr to find a specific string inside the returned IP address. Also, what do you get when you run ipconfig /all on one of these machines? If they have more than one network device they will return more than one ip address... ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
jezr74 Posted October 6, 2005 Author Share Posted October 6, 2005 Check out stringinstr to find a specific string inside the returned IP address. Also, what do you get when you run ipconfig /all on one of these machines? If they have more than one network device they will return more than one ip address...Thank you for the pointer, working fine now!$Subnet = StringLeft(@IPAddress1, 10) if $Subnet = "192.168.1" then IniWrite("C:\Program Files\Info\xp.ini", "XP", "Site", "Office1") if $Subnet = "192.168.2" then IniWrite("C:\Program Files\Info\xp.ini", "XP", "Site", "Office2") if $Subnet = "192.168.3" then IniWrite("C:\Program Files\Info\xp.ini", "XP", "Site", "Office3") if $Subnet = "192.168.4" then IniWrite("C:\Program Files\Info\xp.ini", "XP", "Site", "Office4") $Site=IniRead("C:\Program Files\Info\xp.ini", "XP", "Site", "NOT FOUND") Link to comment Share on other sites More sharing options...
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