Proposed Answer Exception in SQL SMO service

  • Monday, February 13, 2012 10:20 AM
     
      Has Code

    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.

     
    • Edited by Prasad Tendulkar Monday, February 13, 2012 10:21 AM
    • Edited by Prasad Tendulkar Monday, February 13, 2012 10:50 AM
    • Moved by Paul Zhou Tuesday, February 14, 2012 2:34 AM move for better support (From:Common Language Runtime)
    •  

All Replies

  • Tuesday, February 14, 2012 12:28 PM
     
     
    You may want to try restarting the WMI service. This can safely be done without rebooting the machine.
  • Wednesday, February 15, 2012 7:18 AM
     
     

    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?

  • Wednesday, February 15, 2012 9:25 PM
     
     Proposed Answer
    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.
  • Thursday, May 17, 2012 10:41 AM
     
     

    hi please check, this link may help you.

    http://stackoverflow.com/questions/7521069/sql-azure-smo-exception-when-scripting-objects-in-ssms-2008-r2