System.Management.ManagementException

前端 未结 3 1218
梦如初夏
梦如初夏 2021-01-05 12:24

I am running following code:

System.Management.ManagementClass wmiNetAdapterConfiguration = new System.Management.ManagementClass(\"Win32_NetworkAdapterConf         


        
3条回答
  •  死守一世寂寞
    2021-01-05 13:03

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

    I suspect that the WMI service has not been started on the systems that are throwing that exception.

    For troubleshooting purposes, you can verify that using the Administrative Tools → Services utility.

    If this turns out to be the case, you can wrap the code in a try-catch block and use the ServiceController class to start and stop the appropriate service.

提交回复
热议问题