Friday, June 23, 2006

VBScript to Set your SMS 2003 Advanced Client Site Code

Simple script to change site code on a client.

----Begin VBScript----

On Error Resume Next

'Your site code goes here
siteCode = "xyz"

Dim oSMSClient

Set oSMSClient = CreateObject ("Microsoft.SMS.Client")

If Err.Number <> 0 Then
WScript.quit
End If

oSMSClient.SetAssignedSite siteCode

Set oSMSClient=Nothing
----End VBScript----

Tuesday, June 20, 2006

SMS and Corrupted IIS Metabase

I've had to use a little known SMS Corrupted Metabase fix on many occasions, thanks to Marcus Oh and his SMS (and other stuff) blog.

Saturday, June 17, 2006

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!