Disable prevent windows log event

Viewed 78

I'm using WMI (Windows Management Instrumentation) to try to collect some information from a allot of remote computers. The issue is that every time I try to initiate a connection to a remote computer/resource using:

//IWbemLocator::ConnectServer method (wbemcli.h)
m_pLoc->ConnectServer ....

where

IWbemLocator *m_pLoc;

(You can assume m_pLoc is correctly initialized) , if the remote resource is unavailable, Windows generates a log event in the Windows Event Viewer:

DCOM was unable to communicate with the computer ....using any of the configured protocols; requested by PID .....

The problem is that given a huge number of remotes that at some point are not accessible the logs get flooded.

Is there any way to control or to prevent Windows from pushing a event in the Event Viewer every time I try to initiate a connection? Seems that arguments for :

IWbemLocator::ConnectServer method (wbemcli.h)

or CoCreateInstance used to intialize an IWbemLocator do not permit this sort of very custom configuration I'm looking for. Any suggestion or alternatives? Thank you!

1 Answers

Looking at the message logged in EventViewer more closely, I can see that this is a DCOM thing, and it looks like you can turn DCOM error logging off by (as usual) tweaking the registry.

The key you want is:

HKEY_LOCAL_MACHINE
    SOFTWARE
        Microsoft
            Ole

And then create a DWORD value in there called ActivationFailureLoggingLevel and set it to 2.

Info gleaned from here. I haven't tested this myself but it looks like it should work.

Related