How can I know the IP of the computer? - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

Dashut
Posts: 142
Joined: Tue May 04, 2010 4:41 pm

How can I know the IP of the computer?

Using AI 7.7:
I need to know during installation: the IP of the computer that the installer is running on. I don't want "localhost" or stuff like that: I need the WAN IP of the computer.

How can I do that?
Many thanks, Dashut.
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: How can I know the IP of the computer?

Hello,

I'm afraid the only way to retrieve the WAN IP is communicating with a server. Either use whatismyip.com (which prints your IP in the web page's title) or your own web page on which you print the ip address. Retrieve the page and read the IP from the page. May I suggest you use a windows port of the Linux's wget command line tool to painlessly retrieve the web page. You can then read the page with the help of a custom action and store the retrieved IP inside a property.

Another tip: if you want the IP address stored on your web server instead of it being stored on the machine, you can simply use an HTML host control to force the installer to access your web server. The web server can this way get the IP address. In PHP for instance, you can use _SERVER['REMOTE_ADDR'] to retrieve the WAN IP address of the client accessing the web page.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
Dashut
Posts: 142
Joined: Tue May 04, 2010 4:41 pm

Re: How can I know the IP of the computer?

Here's VBS I found on the net that works for me:

Code: Select all

Function GetIPAddress()
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set IPConfigSet = objWMIService.ExecQuery("Select IPAddress from Win32_NetworkAdapterConfiguration ")
DIP = ""
dim x
dim IPAddr(255)
x = 0
For Each IPConfig in IPConfigSet
	If Not IsNull(IPConfig.IPAddress) Then
         For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
                If Not (IPConfig.IPAddress(i)="0.0.0.0") Then
					IPAddr(x) = IPConfig.IPAddress(i)
					x = x + 1
            	End if
        Next
end if
next
'msgbox "First IP is: " & IPAddr(0)
' if more IP's exist, they will be in IPAddr(1), IPAddr(2) and so on
Session.Property("MY_COMPUTER_IP1")=IPAddr(0)

End Function
Dashut.
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: How can I know the IP of the computer?

Hello Dashut,

I'm glad it works for you, however it's important to note the script you have posted won't work when the computer is behind a router. It will report the local IP, not the WAN IP.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
DT6
Posts: 2
Joined: Sat Aug 14, 2010 1:52 am
Location: Europe
Contact: Website

Re: How can I know the IP of the computer?

What if i have no internet connection and it asked for my IP address. What should i do? Thanks!
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: How can I know the IP of the computer?

Hello,

Can you give us more details about the issue?

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
DT6
Posts: 2
Joined: Sat Aug 14, 2010 1:52 am
Location: Europe
Contact: Website

Re: How can I know the IP of the computer?

Nevermind, I think I found it in my network settings.
anbinal
Posts: 2
Joined: Mon Sep 03, 2012 7:36 am

Re: How can I know the IP of the computer?

Dashut wrote:Using AI 7.7:
I need to know during installation: the IP of the computer that the installer is running on. I don't want "localhost" or stuff like that: I need the WAN IP of the computer.

How can I do that?
Many thanks, Dashut.


What ip address do you need during installation?
If you need your computer ip do the following instructions
For Windows xp
1.start->Run
2.cmd
3.Type ipconfig
4.press enter
If you need your WAN ip address visit ip-details.com .Here you can get location of your ip, longitude.latitude also.

Return to “Common Problems”