Answered WMI query results to DataGrid

  • Saturday, March 03, 2012 9:37 AM
     
      Has Code

    Hi,

    I'm trying to get the results of a WMI to display in a datagrid however the code executes without error yet the datagrid doesnt show any output

    Try Dim scope As New ManagementScope("\\" & servername & "\root\MicrosoftDFS") scope.Connect()

    Dim query As New ObjectQuery("SELECT * FROM DfsrReplicatedFolderInfo") Dim searcher As New ManagementObjectSearcher(scope, query) Dim queryCollection As ManagementObjectCollection queryCollection = searcher.Get() DataGridView1.DataSource = queryCollection

    For Each

    queryObj As ManagementObject In searcher.Get() rtbOutput.AppendText(CStr(queryObj("ReplicationGroupName"))) Next

    The WMI query is working as the data can be appended to a textbox.

    Many thanks for your help

    • Edited by RobbieOwens Saturday, March 03, 2012 9:39 AM
    •  

All Replies