/build/static/layout/Breadcrumb_cap_w.png

Get host IP-adress?

Hi there!

I have a (wierd) application that needs to put the machines IP-adress in the registry.
Does anyone have any suggestions how to do this best?

I have been thinking about making a VBS to get the IP, but then I need to get the variable as a InstallShield String.
Isn't there any better way to do this?

Thanks!

/Jonas

0 Comments   [ + ] Show comments

Answers (5)

Posted by: jonasm 17 years ago
Blue Belt
0
I solved it with this VBS, but there must be a better way...

The HOSTIP is the propery that I uses where to set the IP-adress.

/Jonas

[hr]
Set objWMIService = GetObject("winmgmts:")
Set colNicConfig = objWMIService.ExecQuery("SELECT * FROM " & "Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
For Each objNicConfig In colNicConfig
For Each strIPAddress In objNicConfig.IPAddress
'Only get IP-adress if it starts with "10."
If left(strIPAddress,3) = "10." Then
Session.Property("HOSTIP") = strIPAddress
End If
Next
Next
Posted by: Secondlaw 17 years ago
Third Degree Blue Belt
0
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set IPConfigSet = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")

For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
WScript.Echo IPConfig.IPAddress(i)
Next
End If
Next

________________________________________________
That script was generated with, "The Portable Script Center" (Free download) (http://www.microsoft.com/technet/scriptcenter)
Posted by: jonasm 17 years ago
Blue Belt
0
Thanks for your reply.

I maybe wasn't clear enough, but with a "better way" I ment that there maybe was a InstallShield Property or kinda to get the IP-adress without making a VBS.

/Jonas
Posted by: Secondlaw 17 years ago
Third Degree Blue Belt
0
Try a few of these:

http://community.macrovision.com/printthread.php?t=163146
http://www.installshield.com/news/newsletter/archives/0101_oragebrain.pdf
http://www.installsite.org/pages/en/isp_net.htm
http://support.installshield.com/kb/view.asp?articleid=Q105786

Hope that helps.
Posted by: jmcfadyen 12 years ago
5th Degree Black Belt
0
there is no default properties that do what you want. scripted is likely the best option.

secondlaws script could be tweaked to accomodate your session.property changes.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ