Exception in SQL SMO service


  • Code >>

     ManagedComputer comp = new ManagedComputer(serverName, user, password);
                ServiceCollection servcoll = comp.Services;
                foreach (Service service in servcoll)

    The exception is 

    An exception occurred in SMO while trying to manage a service.

    I can see Protection fault on Server

    Faulting application name: wmiprvse.exe, version: 6.1.7601.17514, time stamp: 0x4ce79d42

    Faulting module name: svrenumapi100.dll, version: 2007.100.2531.0, time stamp: 0x49cfcbb5
    Exception code: 0xc0000005

    Seems like permission issue. I have given the WMI permissions to the user. Still it is failing.

    • 已編輯 Prasad Tendulkar 2012年2月13日 上午 10:50
    • 已移動 Paul Zhou 2012年2月14日 上午 02:34 move for better support (From:Common Language Runtime)
    2012年2月13日 上午 10:20


  • You may want to try restarting the WMI service. This can safely be done without rebooting the machine.
    2012年2月14日 下午 12:28
  • Doesn't work. I have rebooted system multiple times.

    I have actually installed SQL Server 2012 (the beta release) and trying to connect it through SMO. Is there a problem?

    2012年2月15日 上午 07:18
  • I haven't tested 2012, I have however had some issues with WMI in pre Windows 2008 R2 SP1, where restarting the service fixed WMI issues.
    2012年2月15日 下午 09:25
  • hi please check, this link may help you.

    2012年5月17日 上午 10:41