what to use instead of winmgmts RRS feed

  • Question

  • Hi,

    I have windows server 2003 machine.
    I need to use VBscript to fetch processor,memory,network etc details.
    I have used the below given code for getting part of the details but it makes my application slower.
    Can anyone suggest some other way by which I can get the required details of my machine and at a quicker time ?
    details needed :- OS name and version, hostname, ip address, MAC address, processor count, processor family, processor speed, processor name, total disk capacity and free disk space.

    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")

    Set colItems = objWMIService.ExecQuery("SELECT CSName, Caption, CSDVersion, Version, TotalVisibleMemorySize FROM Win32_OperatingSystem", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)

    Wednesday, May 16, 2007 11:09 AM


All replies

  • WMI is the primary scripting-oriented system management technique. There are Win32 APIs available to get such details but WMI is the easiest for scripting.
    Thursday, May 17, 2007 5:11 AM
  • Thanks. Can you help me out with a small example.
    Monday, May 21, 2007 4:37 AM
  • I don't think that you can get the information from anywhere else (winmgmts= WMI)

    You can use Powershell instead of VB script and get the objects pretty fast:

    Code Snippet

    $Win = get-WmiObject Win32_OperatingSystem

    "Machine Name =" + $Win.CSName

    "Caption =" + $Win.Caption

    $Nics= get-WmiObject Win32_NetworkAdapterConfiguration
    foreach ( $Mac in $Nics ) { "Mac Address = " + $Mac.MacAddress}

    You can also get WMI object directly from C# if thats what you are trying to do. For instance, see the following article by Kevin Matthew Goss
    Monday, May 21, 2007 5:39 AM
  • Thank you. I would surely wish to some how fasten my vbscript code if it is at all possible.

    Tuesday, May 22, 2007 4:09 AM


    may you try asking the question in one of the Windows Server forums? You may try with the General one, the Management one or eventually with the one for the tech Arnon suggested you: Powershell

    Thursday, August 9, 2007 6:09 PM