There are several different ways to connect to an SMS site server using Vbs. The two most common examples are shown below. The first one uses an input box to prompt you to enter the site server name and the site code. The final script hard codes the variables and all you need to do is specify the site server and site code.
By Input Box: Prompt
strSiteServer = InputBox("Site Server Name")
strSiteCode = InputBox("Site Code")
Set objSWbemServices = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
& strSiteServer & "\root\sms\site_" & strSiteCode)
If Err.Number <> 0 Then
Wscript.Echo "The Connection Failed"
Else
Wscript.Echo "Connection Established"
End If
Wscript.Quit
Hard Coded:
strSiteServer = "Site_Server"
strSiteCode = "Site_Code"
No Comments