• WMI Diskdrives (vb.net 2005)

    Home » Forums » Developers, developers, developers » DevOps Lounge » WMI Diskdrives (vb.net 2005)

    • This topic has 0 replies, 1 voice, and was last updated 17 years ago.
    Author
    Topic
    #451058

    Hi All,
    For a project of mine I found this example of creating Windows Management Instrumentation classes in vb.net to return server information. This all works well and good however I can’t get my mind around how I would be able to use a class when the WMI query will return multiple instances of objects, like disk drives.

    qryStringDD = New ObjectQuery("SELECT * FROM Win32_DiskDrive")
    objDD = New ManagementObjectSearcher(objScope, qryStringDD)
    
    For Each objMgmt In objDD.Get()
        m_strDiskDriveManufacturer = objMgmt("Manufacturer").ToString()
        m_strDiskDriveModel = objMgmt("Model").ToString()
        m_strDiskDriveName = objMgmt("Name").ToString()
        m_strDiskDrivePartitions = objMgmt("Partitions").ToString()
        m_strDiskDriveType = objMgmt("MediaType").ToString()
        m_strDiskDriveSize = objMgmt("Size") / 1073741824
    Next
    

    Also, how would I be able to call a certain instance of an object, in this case a disk drive.
    Thank you.

    Reply To: WMI Diskdrives (vb.net 2005)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: