Поделиться через


GetCurrentVersion Method in Class SMS_SiteControlFile

Applies To: System Center Configuration Manager 2007, System Center Configuration Manager 2007 R2, System Center Configuration Manager 2007 R3, System Center Configuration Manager 2007 SP1, System Center Configuration Manager 2007 SP2

In Configuration Manager, the GetCurrentVersion Windows Management Instrumentation (WMI) class method retrieves the full text of the site control file from memory.

The following syntax is simplified from Managed Object Format (MOF) code and is intended to show the definition of the method.

SInt32 GetCurrentVersion(
   String SiteCode,
   String SCFData
);

Parameters

  • SiteCode
    Data type: String

    Qualifiers: [in, SizeLimit("3")]

    Site code of the site from which to get a full text copy of the site control file.

  • SCFData
    Data type: String

    Qualifiers: [out]

    Full text of the site control file. The version depends on whether your application passes a context object with the session handle. If not, the shared version of the site control file is retrieved.

Return Values

An SInt32 data type that is 0 to indicate success or non-zero to indicate failure.

For information about handling returned errors, see About Configuration Manager Errors.

Remarks

The full text shows the file definition and site definition components of the site control file. This method behaves similarly to the IWbemClassObject::GetObjectText method and the SWbemObject::GetObjectText_ method. See Configuration Manager Context Qualifiers.

Example Code

The following example calls the GetCurrentVersion method without using the session handle, which retrieves the shared version of the site control file.

Dim SCF As SWbemObject
Dim FullText As String
Set SCF = GetObject("winmgmts:root\sms\site_<sitecode>:SMS_SiteControlFile")
SCF.GetCurrentVersion "<sitecode>"
FullText

The following example calls the GetCurrentVersion method using the session handle, which retrieves your current copy of the site control file.

Dim Services As SWbemServices
Dim SCF As SWbemObject
Dim InParams As SWbemObject
Dim OutParams As SWbemObject
Dim SMSContext As New SWbemNamedValueSet
Dim SessionHandle As String
Dim FullText As String
Set Services = GetObject("winmgmts:root\sms\site_<sitecode>")
Set SCF = Services.Get("SMS_SiteControlFile")
SCF.GetSessionHandle SessionHandle
SMSContext.Add "SessionHandle"
SessionHandle
Set InParams = Services.Get("SMS_SiteControlFile")
.Methods_("GetCurrentVersion")
.InParameters.SpawnInstance_
InParams.SiteCode = "<sitecode>"
Set OutParams = Services.ExecMethod("SMS_SiteControlFile"
"GetCurrentVersion"
InParams
SMSContext)
MsgBox "SCF Text" & vbCrLf & vbCrLf & OutParams.SCFData

Requirements

Runtime Requirements

For more information, see Configuration Manager Server Runtime Requirements.

Development Requirements

For more information, see Configuration Manager Server Development Requirements.

See Also

Concepts

SMS_SiteControlFile Server WMI Class
About the Configuration Manager Site Control File
Configuration Manager Context Qualifiers