WMI query in custom installer

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top