Indicates whether SQL Server is running on a computer.
strComputer = "."Set objWMIService = GetObject("winmgmts:" _& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")Set colServices = objWMIService.ExecQuery _("Select * from Win32_Service Where Name = 'MSSQLServer'")If colServices.Count > 0 ThenFor Each objService in colServicesWscript.Echo "SQL Server is " & objService.State & "."NextElseWscript.Echo "SQL Server is not installed on this computer."End If
This is a VB Script, this can be used by saving the file in .vbs file