An exception occurred in SMO while trying to manage a service

Jan 19, 2015 at 9:27 AM
Hi everyone,

Great scripts you have provided Kendal, makes my life sooooo much easier for auditing! I've just register to post my solution to a problem I was having and hoping it might help fellow people if they get the same issue.

Anyway, I had an error last week on quite a lot of servers that said the following:

ERROR: Unable to retrieve service information from FQDN (IP Address): Exception calling "EndInvoke" with "1" argument(s): "The following exception occurred while trying to enumerate the collection: "An exception occurred in SMO while trying to manage a service."."

I also noticed someone else had the same issue as documented here, so I ran the script you suggested and it returned the same error. I took a quick crash course in powershell and SMO and created a 3 line query to test the basic info to run in powershell:

[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SQLWMIManagement') | Out-Null
$m = New-Object ('Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer') 'servername'
$m.ClientProtocols | select DisplayName, IsEnabled


This was returning the error of:

An exception was thrown when trying to enumerate the collection: "An exception occurred in SMO while trying to manage a service.".
At line:1 char:1+ $ <<<< m.ClientProtocols | select DisplayName, IsEnabled


So, obviously something was wrong if you can't return the most basic of information. A couple of hours on Google and I stumbled across a link about opening SQL Service configuration manager. Low and behold, I had the same issue link. Running said command from the link, then trying my basic 3 line code, it worked! So I reran your powerdoc scripts and it worked beautifully!

Hopefully this will help someone if they run into the same problem!

Keep up the great scripts Kendal :-)
Coordinator
Feb 20, 2015 at 1:46 PM
Thanks for posting that fix - and for checking out SQL Power Doc. Glad that you find it useful!