VBScript to check if the SMS service is Installed
Recently I wsa asked how to check if SMS is installed, while there are many ways to do this, I wanted to look for the CCMExec service. This way if SMS is installed by its WMI classes are not there, we still get a true. Alternatives could be to look for the SMS WMI Classes or Add/Remove programs.
----Begin VBScript----
IF IsSMSInstalled = True Then
WScript.Echo "You have SMS Installed"
Else
WScript.Echo "SMS Service Not Found"
End If
Function IsSMSInstalled()
Dim oService
On Error Resume Next
Set oService = GetObject("winmgmts:root/cimv2:Win32_Service.Name='CcmExec'")
If Err = 0 Then IsSMSInstalled = True
On Error GoTo 0
Set oService = Nothing
End Function
----End VBScript----
Have a different way to check for SMS? Post a comment!
----Begin VBScript----
IF IsSMSInstalled = True Then
WScript.Echo "You have SMS Installed"
Else
WScript.Echo "SMS Service Not Found"
End If
Function IsSMSInstalled()
Dim oService
On Error Resume Next
Set oService = GetObject("winmgmts:root/cimv2:Win32_Service.Name='CcmExec'")
If Err = 0 Then IsSMSInstalled = True
On Error GoTo 0
Set oService = Nothing
End Function
----End VBScript----
Have a different way to check for SMS? Post a comment!
About the Author
Emmanuel Tsouris is a Systems Management veteran and Developer Advocate specializing in PowerShell and Cloud Automation. He maintains DotVBS to preserve legacy knowledge for the "archaeologist admin."
Ready to move from VBScript to the Cloud? Check out his book, Pro PowerShell for Amazon Web Services.
Visit EmmanuelTsouris.com for his latest projects.
As an Amazon Associate, I earn from qualifying purchases at no cost to you.
Comments