PC Review Forums Newsgroups Windows XP Windows XP WMI Win32_NetworkAdapterConfiguration, dynamic dial-up ip, static lan

Reply

Win32_NetworkAdapterConfiguration, dynamic dial-up ip, static lan

 
Thread Tools Rate Thread
Old 27-02-2007, 01:06 AM   #1
=?Utf-8?B?UmljaGFyZA==?=
Guest
 
Posts: n/a
Default Win32_NetworkAdapterConfiguration, dynamic dial-up ip, static lan


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

------------------------------------

Always returns 192.168.0.1, drives me nuts!
  Reply With Quote
Old 28-02-2007, 09:54 PM   #2
Richard Stallmann
Guest
 
Posts: n/a
Default Re: Win32_NetworkAdapterConfiguration, dynamic dial-up ip, static lan

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
---------------------------------------------

the CLSID of course depends on the clsid assigned to your adapter


"Richard" <WRFan1@gmail.com> schrieb im Newsbeitrag news:3E9AE67B-957D-48EB-89B2-A6E10E51E611@microsoft.com...
> 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
>
> ------------------------------------
>
> Always returns 192.168.0.1, drives me nuts!



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off