About Get IP Address through WMI ! 
Author Message
 About Get IP Address through WMI !

1. Windows Management Instrumentation on Computers Running Windows 98

The version of Windows Management Instrumentation that the CD provides and
that Control Panel installs does not work properly. For example, test
applications such as the Windows Management Instrumentation Tester
(WBEMTest) utility and the Wmicli.exe sample in the Windows XP DDK do not
work with this version of Windows Management Instrumentation.

Read the description of Windows Management Instrumentation that appears on
the following Microsoft Web page:

Windows Management Instrumentation (WMI) CORE 1.5
http://www.*-*-*.com/
l=/MSDN-FILES/027/001/576/msdncompositedoc.xml

Then download the correct file from the Microsoft Download Center:

Download Wmi9x.exe now
http://www.*-*-*.com/
exe

This version does not support all classes. Missing classes include the
network driver interface specification (NDIS) classes. NDIS does not
install a handler for IRP_MJ_SYSTEM_CONTROL on the retail versions of the
Windows operating system. (This is fixed for Windows 98 Second Edition.
WBEMTest and Wmicli.exe work with this version of Windows Management
Instrumentation.)

2. Windows Management Instrumentation on a Computer That Is Running Windows
98 Second Edition

To install Windows Management Instrumentation on a computer that is running
Windows 98 Second Edition, follow these steps:
Click Start, and then click Control Panel.
Click Windows Setup, click Internet Tools, and then click Web-Based
Enterprise Management.
Click to select the Web-Based Enterprise Mgmt check box, and then close the
Internet Tools box.
WBEMTest and Wmicli.exe work properly on this version of the Windows
operating system.

The NDIS behavior for Windows Management Instrumentation on a computer that
is running Windows 98 Second Edition is different from the behavior on a
computer that is running Windows 2000 or Windows XP. Windows 98 Second
Edition does not send NdisRequest with OID_GEN_SUPPORTED_GUIDS until a
Windows Management Instrumentation client application specifically requests
information from the driver. A computer that is running Windows 2000 or
Windows XP registers with Windows Management Instrumentation and requests
the supporting GUIDs during initialization.

Also, on a computer that is running Windows 98 Second Edition, default
NDIS-supported class objects work, but custom classes do not work. This
functionality works correctly in Windows 2000 and Windows XP.

For example, if you use WBEMTest on a computer that is running Windows
2000, you can query the default NDIS-supported class objects, you can query
the class objects that you have exported, and you can view their instances.
If you use WBEMTest on a computer that is running Windows 98 Second
Edition, you can see the default NDIS-supported class objects, but you may
not be able to see the exported class objects.

With WSH, we also can get the IP address. There is a method called regRead
on the Wscript.shell object. The IP address was located under
HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces.
However, it is not the recommended method.

Gary

This posting is provided "AS IS", with no warranties, and confers no
rights. Enjoyed ASP.NET? http://www.*-*-*.com/



Fri, 13 May 2005 13:57:12 GMT  
 About Get IP Address through WMI !
Quote:

> I need to get IP Adress for our Windows 98 machines but I
> saw that I can use the WMI (Windows Management
> Instrumetation), How can I install WMI for Windows 98, I
> didn't find a specific donwload from MSDN to install WMI.

> I just found WMI download for Windows 2000.

> Do I get IP address with WSH?

Hi

No need to install WMI for this, you can use the built in ipconfig/winipcfg for
this:

arAddresses = GetIPAddresses()

WScript.echo ubound(arAddresses)+1 & " IP Address(es) found"
for each ip in arAddresses
  WScript.echo ip
Next

Function GetIPAddresses()
'=====
' Based on a Michael Harris script, modified be Torgeir Bakken
'
' Returns array of IP Addresses as output
' by ipconfig or winipcfg...
'
' Win98/WinNT have ipconfig (Win95 doesn't)
' Win98/Win95 have winipcfg (WinNt doesn't)
'
' Note: The PPP Adapter (Dial Up Adapter) is
' excluded if not connected (IP address will be 0.0.0.0)
' and included if it is connected.
'=====
  set sh = createobject("wscript.shell")
  set fso = createobject("scripting.filesystemobject")

  Set Env = sh.Environment("PROCESS")
  if Env("OS") = "Windows_NT" then
    workfile = Env("TEMP") & "\" & fso.gettempname
    sh.run "%comspec% /c ipconfig >" & Chr(34) & workfile & Chr(34),0,true
  else
    'winipcfg in batch mode sends output to
    'filename winipcfg.out
    workfile = "winipcfg.out"
    sh.run "winipcfg /batch" ,0,true
  end if
  set sh = nothing
  set ts = fso.opentextfile(workfile)
  data = split(ts.readall,vbcrlf)
  ts.close
  set ts = nothing
  fso.deletefile workfile
  set fso = nothing
  arIPAddress = array()
  index = -1
  for n = 0 to ubound(data)
    if instr(data(n),"IP Address") then
      parts = split(data(n),":")
      'if trim(parts(1)) <> "0.0.0.0" then
      if instr(trim(parts(1)), "0.0.0.0") = 0 then
        index = index + 1
        ReDim Preserve arIPAddress(index)
        arIPAddress(index)= trim(cstr(parts(1)))
      end if
    end if
  next
  GetIPAddresses = arIPAddress
End Function

--
torgeir
Microsoft MVP Scripting and WMI
Porsgrunn Norway



Mon, 16 May 2005 04:39:42 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Get IP Address with WMI

2. Using WMI to get the computers IP address ?

3. vbscript and WMI to set IP Address for a workstation

4. How to get IP Address with WMI and JScript

5. change static ip address remotely via WMI

6. change ip address remotely via WMI

7. wmi and IP address

8. WMI and IP address

9. WMI NetworkAdapterConfiguration.IPAddress[]

10. getting IP address

11. getting ip address

12. Getting Local IP address running a VBS script locally

 

 
Powered by phpBB® Forum Software