Microsoft Knowledge Base Email Alertz

ManagementEventWatcher.Start() may throw an Invalid Parameter Exception

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 947482 - Last Review: January 10, 2008 - Revision: 1.0

ManagementEventWatcher.Start() may throw an Invalid Parameter Exception

Source: Microsoft Support

RAPID PUBLISHING

RAPID PUBLISHING ARTICLES PROVIDE INFORMATION DIRECTLY FROM WITHIN THE MICROSOFT SUPPORT ORGANIZATION. THE INFORMATION CONTAINED HEREIN IS CREATED IN RESPONSE TO EMERGING OR UNIQUE TOPICS, OR IS INTENDED SUPPLEMENT OTHER KNOWLEDGE BASE INFORMATION.

Action

Applications designed to leverage asynchronous WMI events with managed code and the .NET Framework use the EventArrived event and the Start() method of the System.Management.ManagementEventWatcher class.

Result

If default DCOM permissions have been hardened preventing the user account running the application from having local COM security permissions, the Start() method may throw a "Invalid Parameter" (0x80041008) exception.  This method takes no parameters.  So this can be a very confusing exception to encounter.

Cause

This exception can occur as a result of an internal "Access Denied" error when the System.Management class library internally tries to locally use the "Microsoft WBEM Unsecured Apartment" (unsecapp.exe) COM server process. This COM server process is used to forward event callbacks that can not be authenticated.  

In many cases it is not to authenticate event callbacks because many originate from WMI services running under local accounts on remote machines. The SYSTEM, LOCAL SERVICE and NETWORK SERVICE are common examples of local accounts that may be firing these events.

The user account associated to the managed code application making the call, must not be restricted from local DCOM: Limits, Access, or Launch permissions.  The System.Management library calls must be able to use the "Microsoft WBEM Unsecured Apartment" as designed.

Resolution



You should not restrict local COM security access for the user account running the application.  By default local users are granted local COM permission.

You can also explicitly grant your application account permissions as follows

1.) Click Start->Run to run "dcomcnfg"
2.) Navigate the tree control in the Component Services MMC snapin as follows...

        Console Root->Component Services->Computers->My Computer

3.) Right click the "My Computer" node and select Properties from the context menu
4.) Grant the associated application user account Launch and Access permission and also permissions through in the Limits buttons on the COM Security tab.

More Information

 For more information see the documentation on the System.Management.ManagementEventWatcher class and the section entitled "Lowering the Security for a Sink in a Separate Process" in the MSDN

DISCLAIMER

MICROSOFT AND/OR ITS SUPPLIERS MAKE NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY, RELIABILITY OR ACCURACY OF THE INFORMATION CONTAINED IN THE DOCUMENTS AND RELATED GRAPHICS PUBLISHED ON THIS WEBSITE (THE “MATERIALS”) FOR ANY PURPOSE. THE MATERIALS MAY INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS AND MAY BE REVISED AT ANY TIME WITHOUT NOTICE.

TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, MICROSOFT AND/OR ITS SUPPLIERS DISCLAIM AND EXCLUDE ALL REPRESENTATIONS, WARRANTIES, AND CONDITIONS WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO REPRESENTATIONS, WARRANTIES, OR CONDITIONS OF TITLE, NON INFRINGEMENT, SATISFACTORY CONDITION OR QUALITY, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE MATERIALS.

APPLIES TO
  • Microsoft .NET Framework 1.0
  • Microsoft .NET Framework 1.1
  • Microsoft .NET Framework 2.0
  • Microsoft .NET Framework 3.0
  • Microsoft .NET Framework 3.5
Keywords: 
kbnomt kbrapidpub KB947482
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate