Cannot get WMI Events

Topics: Building and extending application blocks, Caching Application Block , Cryptography Application Block, Data Access Application Block, Enterprise Library Core, Exception Handling Application Block, General discussion, Logging Application Block, Policy Injection Application Block, Pre-release discussions, Security Application Block, Validation Application Block
Aug 10, 2008 at 2:42 PM
Edited Aug 10, 2008 at 2:44 PM
After install Enterprise Library 4.0 successfully and enable WMI by running file InstallServices.bat.  I use WMICodeCreator  application to try to catch ConnectionFailedEvent but System always throw “Invalid Class”  exception . To find out what the problem is. I use WMI Diagnosis Utility and the error report as below. Please help me. How to solve this issue?

28319 19:46:14 (2) !! WARNING: WMI provider CIM registrations missing for the following provider(s): ...................................... 55 WARNING(S)!

28320 19:46:14 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Common Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'InstrumentationSetting')

28321 19:46:14 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28322 19:46:14 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Caching Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'CachingBlockSetting')

28323 19:46:14 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28324 19:46:14 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Security.Cryptography Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'CryptographyBlockSetting')

28325 19:46:14 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28326 19:46:14 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Data Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'DatabaseBlockSetting')

28327 19:46:14 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28328 19:46:14 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Logging Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'LoggingBlockSetting')

28329 19:46:14 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28330 19:46:14 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Security Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'SecurityBlockSetting')

28331 19:46:14 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28332 19:46:14 (0) ** - ROOT/ENTERPRISELIBRARY, EnterpriseLibrary.Common.Configuration.Manageability.Tests Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'MockConfigurationSectionSettingB')

28333 19:46:14 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28334 19:46:14 (0) ** - ROOT/ENTERPRISELIBRARY, EnterpriseLibrary.Common.Configuration.Manageability.Tests Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'MockConfigurationSectionSetting')

28335 19:46:14 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28336 19:46:14 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Caching Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'CacheManagerSetting')

28337 19:46:14 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28338 19:46:14 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Caching Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'CustomCacheManagerSetting')

28339 19:46:14 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28340 19:46:14 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Caching Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'UnknownCacheManagerSetting')

28341 19:46:14 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28342 19:46:14 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Caching Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'CustomCacheStorageSetting')

28343 19:46:14 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28344 19:46:14 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Caching Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'IsolatedStorageCacheStorageSetting')

28345 19:46:14 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28346 19:46:14 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Caching Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'NullBackingStoreSetting')

28347 19:46:14 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28348 19:46:14 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Caching.Database Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'DataCacheStorageSetting')

28349 19:46:14 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28350 19:46:14 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Caching.Cryptography Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'SymmetricStorageEncryptionProviderSetting')

28351 19:46:14 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28352 19:46:14 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Security.Cryptography Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'CustomHashProviderSetting')

28353 19:46:14 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28354 19:46:14 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Security.Cryptography Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'HashAlgorithmProviderSetting')

28355 19:46:14 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28356 19:46:14 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Security.Cryptography Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'KeyedHashAlgorithmProviderSetting')

28357 19:46:14 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28358 19:46:14 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Security.Cryptography Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'CustomSymmetricCryptoProviderSetting')

28359 19:46:14 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28360 19:46:14 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Security.Cryptography Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'DpapiSymmetricCryptoProviderSetting')

28361 19:46:14 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28362 19:46:14 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Security.Cryptography Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'SymmetricAlgorithmProviderSetting')

28363 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28364 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Data Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'ConnectionStringSetting')

28365 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28366 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Data Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'OracleConnectionSetting')

28367 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28368 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Data Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'ProviderMappingSetting')

28369 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28370 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'ExceptionPolicySetting')

28371 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28372 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Logging Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'CategoryFilterSetting')

28373 19:46:15 (0) **   MOF Registration: 'WMI information not available ()'

28374 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Logging Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'CustomFilterSetting')

28375 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28376 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Logging Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'LogEnabledFilterSetting')

28377 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28378 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Logging Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'PriorityFilterSetting')

28379 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28380 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Logging Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'BinaryFormatterSetting')

28381 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28382 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Logging Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'CustomFormatterSetting')

28383 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28384 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Logging Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'TextFormatterSetting')

28385 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28386 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Logging Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'XmlTraceListenerSetting')

28387 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28388 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Logging Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'RollingFlatFileTraceListenerSetting')

28389 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28390 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Logging Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'CustomTraceListenerSetting')

28391 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28392 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Logging Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'EmailTraceListenerSetting')

28393 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28394 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Logging Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'FlatFileTraceListenerSetting')

28395 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28396 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Logging Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'FormattedEventLogTraceListenerSetting')

28397 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28398 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Logging Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'MsmqTraceListenerSetting')

28399 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28400 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Logging Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'WmiTraceListenerSetting')

28401 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28402 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Logging.Database Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'FormattedDatabaseTraceListenerSetting')

28403 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28404 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Logging Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'TraceSourceSetting')

28405 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28406 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Security Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'AuthorizationRuleProviderSetting')

28407 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28408 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Security Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'CustomAuthorizationProviderSetting')

28409 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28410 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Security Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'CustomSecurityCacheProviderSetting')

28411 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28412 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.Security.Cache.CachingStore Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'CachingStoreProviderSetting')

28413 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28414 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, EnterpriseLibrary.Common.Configuration.Manageability.Tests Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'MockNamedConfigurationSetting')

28415 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28416 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, EnterpriseLibrary.Common.Configuration.Manageability.Tests Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'MockNamedConfigurationSettingB')

28417 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28418 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'CustomHandlerSetting')

28419 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28420 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'ReplaceHandlerSetting')

28421 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28422 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'WrapHandlerSetting')

28423 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28424 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.WCF Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'FaultContractExceptionHandlerSetting')

28425 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28426 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'LoggingExceptionHandlerSetting')

28427 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28428 19:46:15 (0) ** - ROOT/ENTERPRISELIBRARY, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling Version=4.0.0.0 Culture=neutral PublicKeyToken=null (i.e. WMI Class 'ExceptionTypeSetting')

28429 19:46:15 (0) **   MOF Registration: 'WMI information not available (This could be the case for an external application or a third party WMI provider)'

28430 19:46:15 (0) ** => This is an issue because there are still some WMI classes referencing this list of providers

28431 19:46:15 (0) **    while the CIM registration is wrong or missing. This can be due to:

28432 19:46:15 (0) **    - a de-installation of the software.

28433 19:46:15 (0) **    - a deletion of some CIM registration information.

28434 19:46:15 (0) ** => You can correct the CIM configuration by:

28435 19:46:15 (0) **    - Manually recompiling the MOF file(s) with the 'MOFCOMP <FileName.MOF>' command.

28436 19:46:15 (0) **    Note: You can build a list of classes in relation with their WMI provider and MOF file with WMIDiag.

28437 19:46:15 (0) **          (This list can be built on a similar and working WMI Windows installation)

28438 19:46:15 (0) **          The following command line must be used:

28439 19:46:15 (0) **          i.e. 'WMIDiag CorrelateClassAndProvider'

28440 19:46:15 (0) **    - Re-installing the software.

28441 19:46:15 (0) ** => If the software has been de-installed intentionally, then this information must be

28442 19:46:15 (0) **    removed from the WMI repository. You can use the 'WMIC.EXE' command to remove the provider

28443 19:46:15 (0) **    registration data and its set of associated classes.

28444 19:46:15 (0) **    i.e. 'WMIC.EXE /NAMESPACE:\\ROOT\ENTERPRISELIBRARY path __Win32Provider Where Name='Microsoft.Practices.EnterpriseLibrary.ExceptionHandling Version=4.0.0.0 Culture=neutral PublicKeyToken=null' DELETE'

28445 19:46:15 (0) **    i.e. 'WMIC.EXE /NAMESPACE:\\ROOT\ENTERPRISELIBRARY Class ExceptionTypeSetting DELETE'

28446 19:46:15 (0) ** => If the namespace was ENTIRELY dedicated to the intentionally de-installed software,

28447 19:46:15 (0) **    the namespace and ALL its content can be ENTIRELY deleted.

28448 19:46:15 (0) **    i.e. 'WMIC.EXE /NAMESPACE:\\ROOT path __NAMESPACE Where Name='ENTERPRISELIBRARY' DELETE'

Aug 11, 2008 at 4:50 PM
Can you show the details of the actual error you get in your app?

Fernando
Aug 22, 2008 at 4:59 AM
My source code is:

using System;
using System.Management;
using System.Windows.Forms;

namespace WMISample
{
    public class WMIReceiveEvent
    {
        public WMIReceiveEvent()
        {
            try
            {
                WqlEventQuery query = new WqlEventQuery(
                    "SELECT * FROM ConnectionFailedEvent");

                ManagementEventWatcher watcher = new ManagementEventWatcher(query);
                Console.WriteLine("Waiting for an event...");

                watcher.EventArrived +=
                    new EventArrivedEventHandler(
                    HandleEvent);

                // Start listening for events
                watcher.Start();

                // Do something while waiting for events
                System.Threading.Thread.Sleep(10000);

                // Stop listening for events
                watcher.Stop();
                return;
            }
            catch(ManagementException err)
            {
                MessageBox.Show("An error occurred while trying to receive an event: " + err.Message);
            }
        }
        
        private void HandleEvent(object sender,
            EventArrivedEventArgs e)
        {
            Console.WriteLine("ConnectionFailedEvent event occurred.");
        }

        public static void Main()
        {
            WMIReceiveEvent receiveEvent = new WMIReceiveEvent();
            return;
        }

    }
}

And the error: "An error occurred while trying to receive an event: Invalid class"
Aug 22, 2008 at 12:47 PM

Hi,

Since EntLib defines a custom WMI namespace, you need to set a ManagementScope to your event watcher like this:

   34             WqlEventQuery eventQuery = new WqlEventQuery(query);

   35             ManagementScope scope = new ManagementScope(@"\\.\root\EnterpriseLibrary");

   36 

   37             eventWatcher = new ManagementEventWatcher(scope, eventQuery);



Hope this helps,
Fernando