Hi
I usean instrumentmade by myselfin vb.netusingSMOobjectsto managea mixed groupof about80MSSqlServer (rel. 2005-2008 r2 & 2012)
With this toolIcheckthe status of services,changeservice accountsand their passwords,etc.
A few days ago one serverstarted toreturn anerror when I run
the first operationon anyproperty of the objectManagedComputerjust created.
Error: "Error 5 - An exception occurred in SMO while trying to manage a service"
This is my code:
If UserID = "" Then
'//Use the credentials of current user
mc = New ManagedComputer(serverName)
Else
'// Use the credentials provided by interface
mc = New ManagedComputer(serverName, UserID, UserPsw)
End If
str = ""
For x = 0 To mc.Services.Count - 1
With mc.Services.Item(x)
servNome = .Parent.Name.ToUpper
srvNome = .Name
srvStato = .ServiceState.ToString
srvStartMode = .StartMode.ToString
srvAccount = .ServiceAccount
........
End If
End With
Next
The instruction mc.Services.Count generates the error below:
smoex = {"An exception occurred in SMO while trying to manage a service."}
Microsoft.SqlServer.Management.Smo.FailedOperationException = {"An exception occurred in SMO while trying to manage a service."}
_HResult = -2146233088
_message = "An exception occurred in SMO while trying to manage a service."
Data = {System.Collections.ListDictionaryInternal}
FailedObject = Nothing
HelpLink = "http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=11.0.2100.60+((SQL11_RTM).120210-1846+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.InnerWmiException&LinkId=20476"
HResult = -2146233088
InnerException = {"Failed to retrieve data for this request."}
IPForWatsonBuckets = 1670498764
IsTransient = False
Message = "An exception occurred in SMO while trying to manage a service."
Operation = ""
ProductName = "Microsoft SQL Server"
ProdVer = "11.0.2100.60 ((SQL11_RTM).120210-1846 )"
RemoteStackTrace = Nothing
SmoExceptionType = FailedOperationException {12}
Source = "Microsoft.SqlServer.SqlWmiManagement"
StackTrace = " in Microsoft.SqlServer.Management.Smo.Wmi.WMIProxy.ExecProcess(Object request) in Microsoft.SqlServer.Management.Smo.Wmi.WmiSmoObject.EnumChildren(String childTypeName, WmiCollectionBase
coll) in Microsoft.SqlServer.Management.Smo.Wmi.ServiceCol...
TargetSite = {System.Object ExecProcess(System.Object)}
WatsonBuckets = Nothing
The server not have problems and the local Sql Server Configuration Manager work fine.
I copied the tool on the server to run itlocally. Strangely, if I use the credentials of the current logged user the tool works
(mc = New ManagedComputer(serverName) )
If I provide explicit the credentials(domain\username and password, but the same of user logged in the server)is not working
( mc = New ManagedComputer(serverName, UserID, UserPsw) )
From a remote serverinsteaddoes not workin both modes.
The server configuration:os Win 2008 R2 EE Sp1 , Ms Sql 2008 R2 Sp2 10.50.4321
Anysuggestion ismuch appreciated
Many thanksin advance