Get System IP-Address? (Oracle 10g)
I'm working on a msi-package for Oracle 10g.
An IP-Address is added in the registry:
[HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\OracleMTSRecoveryService\Protid_0]
"Host"="IP-ADRESS"
"Name"="HTTP"
"Port"="2030"
The ip that is added is the ip on the computer i made the setup capture on. Is there anyway to make this dynamic, so that it takes the ip from the computer/s we will install the package on?
Thanks for a great board! I had ODBC-problems too but solved it by reading here!
An IP-Address is added in the registry:
[HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\OracleMTSRecoveryService\Protid_0]
"Host"="IP-ADRESS"
"Name"="HTTP"
"Port"="2030"
The ip that is added is the ip on the computer i made the setup capture on. Is there anyway to make this dynamic, so that it takes the ip from the computer/s we will install the package on?
Thanks for a great board! I had ODBC-problems too but solved it by reading here!
0 Comments
[ + ] Show comments
Answers (12)
Please log in to answer
Posted by:
jonasm
17 years ago
Hi there!
I once made a VBS Custom Action to get the client IP.
Just be aware of that the registry will not change if the IP on the computer change.
I did rem some of it, to make it fit my case, maybe you need to modify it.
I have also changed so it only takes IP-adresses starting with "10."
Then can you just get the IP from the propery HOSTIP.
I have maked it to run "After InstallInitialized" and only when "NOT Installed"
Hope it works!
/Jonas
-------------------------------
Set objWMIService = GetObject("winmgmts:")
Set colNicConfig = objWMIService.ExecQuery("SELECT * FROM " & "Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
For Each objNicConfig In colNicConfig
' WScript.Echo "Network Adapter: " & objNicConfig.Index
' WScript.Echo " IP Address(es):"
'If NOT IsNull(objNicConfig.IPAddress) Then
For Each strIPAddress In objNicConfig.IPAddress
If left(strIPAddress,3) = "10." Then
RealIPAdress = strIPAddress
Session.Property("HOSTIP") = RealIPAdress
End If
Next
'End If
Next
------------------------------
I once made a VBS Custom Action to get the client IP.
Just be aware of that the registry will not change if the IP on the computer change.
I did rem some of it, to make it fit my case, maybe you need to modify it.
I have also changed so it only takes IP-adresses starting with "10."
Then can you just get the IP from the propery HOSTIP.
I have maked it to run "After InstallInitialized" and only when "NOT Installed"
Hope it works!
/Jonas
-------------------------------
Set objWMIService = GetObject("winmgmts:")
Set colNicConfig = objWMIService.ExecQuery("SELECT * FROM " & "Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
For Each objNicConfig In colNicConfig
' WScript.Echo "Network Adapter: " & objNicConfig.Index
' WScript.Echo " IP Address(es):"
'If NOT IsNull(objNicConfig.IPAddress) Then
For Each strIPAddress In objNicConfig.IPAddress
If left(strIPAddress,3) = "10." Then
RealIPAdress = strIPAddress
Session.Property("HOSTIP") = RealIPAdress
End If
Next
'End If
Next
------------------------------
Posted by:
polkagris
17 years ago
Posted by:
jonasm
17 years ago
Posted by:
aogilmor
17 years ago
Posted by:
polkagris
17 years ago
jonasm:
I been reading more about vbscripts and I have been trying to use just that.
With your script i get on error for line: Session.Property("HOSTIP") = RealIPAdress
Error: Object Required: 'Session'
Know anything about that.?
I'm also having trouble to get some vb-scripts to work properly withing Wise Package Studio. They work fine alone outside the package. Is it something special I have to think about when calling them (path to the scripts and wscript.exe etc is correct)? For example, put it in deffered section or immediate.
I been reading more about vbscripts and I have been trying to use just that.
With your script i get on error for line: Session.Property("HOSTIP") = RealIPAdress
Error: Object Required: 'Session'
Know anything about that.?
I'm also having trouble to get some vb-scripts to work properly withing Wise Package Studio. They work fine alone outside the package. Is it something special I have to think about when calling them (path to the scripts and wscript.exe etc is correct)? For example, put it in deffered section or immediate.
Posted by:
polkagris
17 years ago
Posted by:
jonasm
17 years ago
Posted by:
spartacus
16 years ago
Posted by:
anonymous_9363
16 years ago
Graham, whatever the IP address is, that script will pick it up, irrespective of whether it's static of provided by DHCP. I'm wondering how it would cope on machines with my than one adapter, mind... Not a typical scenario, that's true, but I like my solutions to be as bullet-proof as possible. There's probably additional code that could be added to determine which is the primary adapter, I guess, but as it stands, it rates an 'OK'.Using a fixed IP address for the host value in the registry sounds risky, IMHO. What happens if the local machine IP address changes - e.g. in a DHCP environment ?
Posted by:
vishaujjain121
13 years ago
Posted by:
anonymous_9363
13 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.