How to Adjust SMS Component Settings
Published : April 11, 2005
You can use the following script to change a configuration parameter for the SMS Site Component Manager.
On This Page
Example
Compiling the Code
See Also
Example
Dim objSWbemLocator Dim objSWbemServices Dim objSWbemContext Dim objSWbemInst Dim ProviderLoc Dim Location Dim PropArray Dim x Dim Sitecode Dim Server Sitecode = "SITECODE" Server = "SERVERNAME" Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator") Set objSWbemServices= objSWbemLocator.ConnectServer(".", "root\sms") Set ProviderLoc = objSWbemServices.InstancesOf("SMS_ProviderLocation") For Each Location In ProviderLoc If Location.ProviderForLocalSite = True Then Set objSWbemServices = objSWbemLocator.ConnectServer _ (Location.Machine, "root\sms\site_" + Location.SiteCode) End If Next 'Connect to the site control file. Set objSWbemContext=CreateObject("WbemScripting.SWbemNamedValueSet") objSWbemContext.Add "SessionHandle", objSWbemServices.ExecMethod("SMS_SiteControlFile", "GetSessionHandle").SessionHandle 'Refresh our copy of the SiteControlFile. objSWbemServices.ExecMethod "SMS_SiteControlFile.Filetype=1,Sitecode=""" & _ Sitecode & """", "Refresh", , , objSWbemContext 'Retrieve Site Control Item instance. Set objSWbemInst = objSWbemServices.Get("SMS_SCI_Component.Filetype=1,Itemtype=""Component"",Sitecode=""" & _ Sitecode & """,ItemName=""SMS_SITE_COMPONENT_MANAGER|" & UCase(Server) & """", , objSWbemContext) 'Retrieve the "props" property. PropArray = objSWbemInst.props x = PropArray(0).Value PropArray(0).Value = x + 1 objSWbemInst.props = PropArray 'Store the instance. objSWbemInst.Put_ , objSWbemContext 'Run SMS_SiteControlFile::Commit to update the site control file 'with the new InterPoll Delay time. objSWbemServices.ExecMethod "SMS_SiteControlFile.Filetype=1,Sitecode=""" & Sitecode & """", "Commit", , , objSWbemContext 'Release the site control file. objSWbemServices.Get("SMS_SiteControlFile").ReleaseSessionHandle objSWbemContext.Item("SessionHandle").Value
Compiling the Code
Requires Windows 2000 Server SP2 or later.
Requires an SMS 2003 Site Server.
See Also
Tasks
How to Query SMS Component Status for a Specified Interval
How to Use the Site Control File