johnnyg123
asked on
vbs script to check MSSQLSERVER
I have the following script running as a scheduled task (has been running for over a year)
(note: computer/email names changed for security)
Set objComputer = GetObject("WinNT://test123 ,computer" )
objComputer.Filter = Array("Service")
Dim iMsg
Dim iConf
Dim Flds
Dim strHTML
Dim strSmartHost
Const cdoSendUsingPort = 2
StrSmartHost = "mail.test.local"
set iMsg = CreateObject("CDO.Message" )
set iConf = CreateObject("CDO.Configur ation")
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmartHost
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
.Update
End With
For Each aService In objComputer
select case aService.Name
case "MSSQLSERVER"
if aService.Status <> 4 then
With iMsg
Set .Configuration = iConf
.To = "IT@elgin.com"
.From = "Webdbadmin@elgin.com"
.Subject = "The SQL Server on test123 is not running!"
.TextBody = "SQL Server is not running. ."
.Send
End With
end if
end select
Next
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
We started receiving the message saying it is not running when it is
Any one have ideas as to why the false negative?
(note: computer/email names changed for security)
Set objComputer = GetObject("WinNT://test123
objComputer.Filter = Array("Service")
Dim iMsg
Dim iConf
Dim Flds
Dim strHTML
Dim strSmartHost
Const cdoSendUsingPort = 2
StrSmartHost = "mail.test.local"
set iMsg = CreateObject("CDO.Message"
set iConf = CreateObject("CDO.Configur
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmartHost
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
.Update
End With
For Each aService In objComputer
select case aService.Name
case "MSSQLSERVER"
if aService.Status <> 4 then
With iMsg
Set .Configuration = iConf
.To = "IT@elgin.com"
.From = "Webdbadmin@elgin.com"
.Subject = "The SQL Server on test123 is not running!"
.TextBody = "SQL Server is not running. ."
.Send
End With
end if
end select
Next
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
We started receiving the message saying it is not running when it is
Any one have ideas as to why the false negative?
I suggest you add more areas to the Topic (and tags) as this is not (purely) a MS SQL Server question in my opinion.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.