WMI query in custom installer

  • Thread starter Thread starter Bandu
  • Start date Start date
B

Bandu

Hi,

Why can't I execute the following code segment from custom
installer ?

ManagementScope myScope = new ManagementScope("\\root\
\cimv2");
myScope.Connect();
SelectQuery oQuery = new SelectQuery("SELECT * FROM
Win32_NetworkConnection");

ManagementObjectSearcher searcher = new
ManagementObjectSearcher(myScope, oQuery);

ManagementObjectCollection moc = searcher.Get();

MessageBox.Show(moc.Count.ToString());

When I run it from WinForm, it give me correct answer.
But if I run it from custom installer, "searcher.Get()" always return
0, which is wrong.

Any suggestion or thought?

Regards,

Bandu
 
Back
Top