locked
System.Management EXception RRS feed

  • Question

  • While launching an application I am getting a System.Management Error of exception 

    Error Source: Launcher: System.Management
    Error Message: Invalid class 
    Error Description:    at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)

    at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext()

    For a particular machine i 'm getting this error.How to resolve this exception???

    Thursday, October 22, 2015 5:41 AM

Answers

  • Please post the code that is causing the exception and the call stack. 

    Given the error I'm wagering you're using WMI to query for a class that isn't installed on the machine in question.  The available WMI classes is determined by the provider(s) installed and not every class is available on every machine. For example a machine without IIS won't have any IIS-related classes. 

    By looking at the line that is crashing and seeing what class(es) it is querying for you can then use WMI Code Creator or equivalent and verify the WMI class is actually installed on the machine. If not then you need to install it.  Note also that some WMI classes only work with certain OS versions so it could also be a versioning issue.

    Michael Taylor
    http://blogs.msmvps.com/p3net

    • Proposed as answer by Kristin Xie Thursday, October 29, 2015 9:42 AM
    • Marked as answer by Kristin Xie Thursday, November 5, 2015 7:41 AM
    Thursday, October 22, 2015 4:42 PM

All replies

  • Hi Tough,

    The functionality provided by the System.Management namespace is dependent upon the WMI (Windows Management Instrumentation) service.

    I think your WMI service might not started on the machine that are throwing that exception.
    For troubleshooting, check if the service is started do the following:

    > Go to: Control Panel -> Administrative Tools -> Services utility

    > Check Windows Management Instrumentation service is started.

    Hope this Helps you.

    Thanks,

    Sabah Shariq


    Please remember to mark the replies as answers if they help. If this post is helpful please vote.




    Thursday, October 22, 2015 8:38 AM
  • Hi Sabah,

    The Windows Management Instrumentation service is running.

    Anything else i need to do?

    Thursday, October 22, 2015 9:25 AM

  • For a particular machine i 'm getting this error.How to resolve this exception???

    You said for a particular machine. Does your program works on another machine?
    Thursday, October 22, 2015 9:40 AM
  • Yes....
    Thursday, October 22, 2015 9:50 AM
  • Please post the code that is causing the exception and the call stack. 

    Given the error I'm wagering you're using WMI to query for a class that isn't installed on the machine in question.  The available WMI classes is determined by the provider(s) installed and not every class is available on every machine. For example a machine without IIS won't have any IIS-related classes. 

    By looking at the line that is crashing and seeing what class(es) it is querying for you can then use WMI Code Creator or equivalent and verify the WMI class is actually installed on the machine. If not then you need to install it.  Note also that some WMI classes only work with certain OS versions so it could also be a versioning issue.

    Michael Taylor
    http://blogs.msmvps.com/p3net

    • Proposed as answer by Kristin Xie Thursday, October 29, 2015 9:42 AM
    • Marked as answer by Kristin Xie Thursday, November 5, 2015 7:41 AM
    Thursday, October 22, 2015 4:42 PM