title: unable to get installed software details of vm machine of azure using System.Management
body: <p>My requirement is to get installed software details of vm machine of azure and store the details in db. but when I try to get the details using System.Management class I am getting the below error</p>
  
  <blockquote>
    <p>System.Runtime.InteropServices.COMException: 'The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)'</p>
  </blockquote>
  
  <p>below is my sample code I am using to get the software details </p>
  
  <pre><code> string SoftwareQuery = "SELECT * FROM Win32_Product";
          ConnectionOptions connection = new ConnectionOptions();
  
  
  
              connection.Username = "bla bla";
              connection.Password = "Password";
  
          connection.EnablePrivileges = true;
          connection.Impersonation = ImpersonationLevel.Impersonate;
  
          ManagementScope managementScope = new ManagementScope(@"\\xxxx.xxxx.cloudapp.azure.com:3389\root\CIMV2", connection);
          managementScope.Path = ManagementPath.DefaultPath;
          managementScope.Connect();
  
  
          ObjectQuery queryObj = new ObjectQuery(SoftwareQuery);
          ManagementObjectSearcher searcher = new ManagementObjectSearcher(managementScope, queryObj);
  
          foreach (ManagementBaseObject managementObj in searcher.Get())
          {
  
             //get the software list here 
  
          }
  </code></pre>
  
  <p><strong>Note:</strong> The above code is working on intranet properly</p>
  
  <p>Please let me know anyone have solution on this.</p>