Sign in to follow this  
Followers 0
tharris

Check IP Address and Display Specific One

5 posts in this topic

I looking for a way to display a specific IP Address so our Help Desk can use it to display the users internal VPN IP Address. Currently I have the below script which will display the local IP address as well as IP Address 2 which I make the assumption will be the internal VPN address. This works most of the time unless some bozo has their LAN cable & WiFi connected which causes the VPN address to be bumped to the third one. Everytime you log in to VPN you are assigned an IP address that starts with 10.10.*.* What I would like to do is have it scroll all 4 of the IP Address variables in Autoit and then only display the one that starts with 10.10.*.* I am inserting what I currently use which I'm sure will not be much help.

CODE
MsgBox(0,"System Information", "Machine Name is " & @ComputerName & @CRLF & @CRLF & "User Name is " & @UserName & @CRLF & @CRLF & "Local IP is " & @IPAddress1 & @CRLF & @CRLF & "VPN IP is " & @IPAddress2 & @CRLF & @CRLF & "Click OK when finished.")

Any help would be greatly appreciated.

Share this post


Link to post
Share on other sites



Ok I was trying to make this alot harder than it should have been. I have it mostly working but need help with the wild card function. Could someone please point me in the correct direction for that?

CODE
If @IPAddress1 = 10.10 & ".*.*" Then

MsgBox (0, "VPN IP", "Your VPN IP Address is " & @IPAddress1)

ElseIf @IPAddress2 = 10.10 & ".*.*" Then

MsgBox (0, "VPN IP", "Your VPN IP Address is " & @IPAddress2)

Else

If @IPAddress3 = 10.10 & ".*.*" Then

MsgBox (0, "VPN IP", "Your VPN IP Address is " & @IPAddress3)

Else

MsgBox (0, "VPN IP", "Your VPN IP Address is " & @IPAddress4)

EndIf

EndIf

Share this post


Link to post
Share on other sites

Exactly what tharris has pointed out. You need to compare the ip addresses to 10.10 & ".*.*". If the first one isnt the ip address then try the second, and if the second isnt the one then try the third and so on.

Hiyoal :)

Share this post


Link to post
Share on other sites

@tharris - You can try this:

Local $sTestSegment = "10.10."
Local $sVPNAddress = "N/A"
Local $sAll_IP = "," & @IPAddress1 & "," & @IPAddress2 &","& @IPAddress3 &","& @IPAddress4 & ","
Local $aMatches=StringRegExp($sAll_IP, ",(" & StringReplace($sTestSegment, ".", "\.") & ".+?),",3)
if IsArray($aMatches) then MsgBox(0,"VPN IP", "Your VPN IP Address is " & $aMatches[0])oÝ÷ ØÊ,¶¨¦W¡j÷­®è+jÊb^Li¥«mz¹ìN¬².ÖÞy«"z»h~e£®¶­sdÆö6Âb33c·5FW7E6VvÖVçBÒgV÷C³ãâgV÷C°¤Æö6Âb33c·5eäFG&W72ÒgV÷C´âôgV÷C° ¥6VÆV7@¢66R7G&ætÆVgBFG&W73Â7G&ætÆVâb33c·5FW7E6VvÖVçBÒb33c·5FW7E6VvÖVç@¢b33c·5eäFG&W72ÒFG&W73¢66R7G&ætÆVgBFG&W73"Â7G&ætÆVâb33c·5FW7E6VvÖVçBÒb33c·5FW7E6VvÖVç@¢b33c·5eäFG&W72ÒFG&W73 ¢66R7G&ætÆVgBFG&W732Â7G&ætÆVâb33c·5FW7E6VvÖVçBÒb33c·5FW7E6VvÖVç@¢b33c·5eäFG&W72ÒFG&W730¢66R7G&ætÆVgBFG&W73BÂ7G&ætÆVâb33c·5FW7E6VvÖVçBÒb33c·5FW7E6VvÖVç@¢b33c·5eäFG&W72ÒFG&W73@¤VæE6VÆV7@ ¤×6t&÷ÂgV÷CµeâgV÷C²ÂgV÷Cµ÷W"eâFG&W722gV÷C²fײb33c·5eäFG&W72

@Hiyoal - I think you missed that tharris is the OP.


[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

@tharris - You can try this:

Local $sTestSegment = "10.10."
Local $sVPNAddress = "N/A"
Local $sAll_IP = "," & @IPAddress1 & "," & @IPAddress2 &","& @IPAddress3 &","& @IPAddress4 & ","
Local $aMatches=StringRegExp($sAll_IP, ",(" & StringReplace($sTestSegment, ".", "\.") & ".+?),",3)
if IsArray($aMatches) then MsgBox(0,"VPN IP", "Your VPN IP Address is " & $aMatches[0])oÝ÷ ØÊ,¶¨¦W¡j÷­®è+jÊb^Li¥«mz¹ìN¬².ÖÞy«"z»h~e£®¶­sdÆö6Âb33c·5FW7E6VvÖVçBÒgV÷C³ãâgV÷C°¤Æö6Âb33c·5eäFG&W72ÒgV÷C´âôgV÷C° ¥6VÆV7@¢66R7G&ætÆVgBFG&W73Â7G&ætÆVâb33c·5FW7E6VvÖVçBÒb33c·5FW7E6VvÖVç@¢b33c·5eäFG&W72ÒFG&W73¢66R7G&ætÆVgBFG&W73"Â7G&ætÆVâb33c·5FW7E6VvÖVçBÒb33c·5FW7E6VvÖVç@¢b33c·5eäFG&W72ÒFG&W73 ¢66R7G&ætÆVgBFG&W732Â7G&ætÆVâb33c·5FW7E6VvÖVçBÒb33c·5FW7E6VvÖVç@¢b33c·5eäFG&W72ÒFG&W730¢66R7G&ætÆVgBFG&W73BÂ7G&ætÆVâb33c·5FW7E6VvÖVçBÒb33c·5FW7E6VvÖVç@¢b33c·5eäFG&W72ÒFG&W73@¤VæE6VÆV7@ ¤×6t&÷ÂgV÷CµeâgV÷C²ÂgV÷Cµ÷W"eâFG&W722gV÷C²fײb33c·5eäFG&W72

@Hiyoal - I think you missed that tharris is the OP.

Thank you for this. I never could get the wild cards to work but both of these methods do exactly what I am wanting. Now I just have to break it down and figure out exactly how it works so I don't have to come ask for help again next time.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0