views:

19

answers:

0

I have a simple piece of C# 3.5 that does this:

SelectQuery allProductsQuery = new SelectQuery("Win32_Product");
ManagementObjectSearcher allProducts =
new ManagementObjectSearcher(allProductsQuery);
foreach(ManagementObject product in allProducts.Get())
{
foreach(PropertyData property in product.Properties)
{
Console.WriteLine("{0} = {1}", property.Name,
property.Value);
}
Console.WriteLine("Path = {0}", product.Path);
Console.WriteLine();
}

( borrowed from http://groups.google.com/group/microsoft.public.dotnet.framework.clr/browse_thread/thread/3f167f05ad392ecd )

It works fine on Windows Server 2008 and Vista, but crashes immediately with an Exception under Win Server 2003. What could be wrong?

Thanks.

related questions