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: StringQualifiers: [in, SizeLimit("3")]Site code of the site from which to get a full text copy of the site control file.
SCFData


Data type: StringQualifiers: [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.

  Copy Code
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.

  Copy Code
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

Development Requirements

See Also


Send comments about this topic to Microsoft.