DCOM exception for monitoringhost process

Hi all,

the last couple of weeks were very busy with getting ready for TechReady and high incoming volume.

There is this very interesting issue with creating a custom Management Pack which created an object inside the monitoringhost process-> New-Object -ComObject ComObjectWished

If you get the error Error Message is: Retrieving the COM class factory for component with CLSID {CLSID_OF_THE_APP} failed due to the following error: 80070005.

Now 80070005 is an access denied error, but confusingly all the rights are actually given on the agent. Also running the script manually, so not from a monitoringhost instance works!

This is a DCOM issue, which can be overcome with the AppID. Just create a CLSID in DCOM with an AppID where you then create RunAs = "Interactive User".

This configures a class to run under a specific user account when activated by a remote client without being written as a service application, which then solved the permission issues.

More details here: https://msdn.microsoft.com/en-us/library/windows/desktop/ms680046(v=vs.85).aspx