title: ManagementObjectSearcher query results in Exception from HRESULT: 0x8007007E
body: <p>The full error is</p>
  
  <blockquote>
    <p>The specified module could not be found. (Exception from HRESULT:
    0x8007007E)</p>
  </blockquote>
  
  <p>I am running the same code on many machines without a problem, the client uses windows 7.</p>
  
  <p>The code is</p>
  
  <pre><code> Function OperatingSystemDetails() As String
      Dim RetString As New System.Text.StringBuilder
      Try
          Dim searcher As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_OperatingSystem")
          For Each queryObj As ManagementObject In searcher.Get()
              RetString.Append("SerialNumber: " &amp; StrReverse(Trim(queryObj("SerialNumber"))) &amp; Environment.NewLine)
          Next
      Catch err As ManagementException
          RetString.Clear()
          RetString.Append("ERROR: " &amp; err.Message)
      End Try
      Return RetString.ToString
  End Function
  </code></pre>
  
  <p>Could it really be that the DLL (System.Management (in System.Management.dll)) is missing or corrupt or is it more likely that the client has a service turned off. Does anyone know which windows service it is?</p>
  
  <p>Edit: I have tried to find examples to check for presence of the data but failed. </p>