Win32_NetworkAdapterConfiguration, dynamic dial-up ip, static lan

G

Guest

I've set my lan connection ip to static, 192.168.0.1. I also have a dial-up
connection to the internet, the ip is dynamic and is assigned by my provider
when I connect to the internet. I am trying to find out my dial-up internet
address through WMI, but it always returns only my static lan ip! How do I
find out my dynamic dial-up IPv4 address through WMI without setting my lan
IPv4 address to automatic detection? I need it to stay statically assigned to
this lan ip.

Here's the script I am using:

-----------------------------
Set objWMIService = GetObject("winmgmts:\root\cimv2")

Set colFiles = objWMIService.ExecQuery("select IPAddress from
Win32_NetworkAdapterConfiguration where Description = 'Realtek RTL8168/8111
Family PCI-E Gigabit Ethernet NIC (NDIS 6.0)'")


For Each oInstance In colFiles

For Each oProperty In oInstance.Properties_

For Each prop in oInstance.ipaddress

if oProperty.name = "IPAddress" then
Wscript.Echo oProperty.name & " " & prop
end if

Next

next
next
 
R

Richard Stallmann

Man, you never get any answers on the internet, even such simple questions stay unanswered. Ok, I got it:

-------------------------------------------
Const HKEY_LOCAL_MACHINE = &H80000002
strKeyPath = "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{72034C6B-26E1-4C2D-9864-B96A57018BD5}"
strEntryName = "DhcpIPAddress"
Set objReg=GetObject("winmgmts:\\.\root\default:StdRegProv")
objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Wscript.Echo strValue
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top