Share via


How to Customize Advertisement Branding Information in Configuration Manager

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

You set the software distribution branding information for the Microsoft System Center Configuration Manager 2007 client by changing the SWDBrandingSubTitle property of the client agent component section in the site control file.

To customize advertisement branding information

  1. Set up a connection to the SMS Provider. For more information, see About the SMS Provider in Configuration Manager.

  2. Get the Client Agent site control file Client Component object from SMS_SCI_ClientComp Server WMI Class.

  3. Set the IClientAgentSettings::SWDBrandingSubtitle Property to the value you want.

  4. Commit the changes back to the site control file.

Example

The following example method changes the software distribution branding text to the supplied value.

For information about calling the sample code, see Calling Configuration Manager Code Snippets.

Sub SetAdvertBranding(swbemServices,          _
                      siteCode,               _
                      brandingText)

 
    ' Load the site control file and get the Client Agent section.
    swbemServices.ExecMethod "SMS_SiteControlFile.Filetype=1,Sitecode=""" & siteCode & """", "Refresh", , , swbemContext
        
    Query = "SELECT * FROM SMS_SCI_ClientComp " & _
            "WHERE ClientComponentName = 'Client Agent' " & _
            "AND SiteCode = '" & siteCode & "'"
    
    Set SCIComponentSet = swbemServices.ExecQuery(Query, ,wbemFlagForwardOnly Or wbemFlagReturnImmediately, swbemContext)
                       
    ' Only one instance is returned from the query.
    For Each SCIComponent In SCIComponentSet                              
    
        ' Loop through the array of embedded SMS_EmbeddedProperty instances.
        For Each vProperty In SCIComponent.Props
            
            ' Setting: SWDBrandingSubTitle
            If vProperty.PropertyName = "SWDBrandingSubTitle" Then
                wscript.echo " "
                wscript.echo vProperty.PropertyName
                wscript.echo "Current value " &  vProperty.Value1               
                
                ' Modify the value.
                vProperty.Value1 = brandingText
                wscript.echo "New value: " & brandingText
            End If
               
        Next   

             ' Update the component in your copy of the site control file. Get the path
             ' to the updated object, which could be used later to retrieve the instance.
              Set SCICompPath = SCIComponent.Put_(wbemChangeFlagUpdateOnly, swbemContext)
    Next
                          
    ' Commit the change to the actual site control file.
    Set InParams = swbemServices.Get("SMS_SiteControlFile").Methods_("CommitSCF").InParameters.SpawnInstance_
    InParams.SiteCode = siteCode
    swbemServices.ExecMethod "SMS_SiteControlFile", "CommitSCF", InParams, , swbemContext
      
    ' Release the copy of the site control file.
    swbemServices.Get("SMS_SiteControlFile").ReleaseSessionHandle swbemContext.Item("SessionHandle").Value

End Sub
public void SetAdvertBranding(WqlConnectionManager connection, string siteCode,  string brandingText)
{
    try
    {
        // Get the site control file client component section.
        IResultObject clientAgent = connection.GetInstance(@"SMS_SCI_ClientComp.FileType=1,ItemType='Client Component',SiteCode='" + siteCode + "',ItemName='Client Agent'");

        // Update the branding information.
        Dictionary<string, IResultObject> embeddedProperties = clientAgent.EmbeddedProperties;

        embeddedProperties["SWDBrandingSubTitle"]["Value1"].StringValue=brandingText;

        clientAgent.EmbeddedProperties = embeddedProperties;
        // Commit the change back to the site control file.
        clientAgent.Put();

    }
    catch (SmsException e)
    {
        Console.WriteLine("Failed to set branding text: " + e.Message);
        throw;
    }
}

The example method has the following parameters:

Parameter Type Description

connection

  • Managed: WqlConnectionManager

  • VBScript: SWbemServices

A valid connection to the SMS Provider.

siteCode

  • Managed: String

  • VBScript: String

The site code for the Configuration Manager 2007 site.

brandingText

  • Managed: String

  • VBScript: String

The text used to update the branding text.

Compiling the Code

This C# example requires:

Namespaces

System

System.Collections.Generic

System.Text

Microsoft.ConfigurationManagement.ManagementProvider

Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine

Assembly

adminui.wqlqueryengine

microsoft.configurationmanagement.managementprovider

Robust Programming

For more information about error handling, see About Configuration Manager Errors.

Security

For more information about securing Configuration Manager applications, see Securing Configuration Manager Applications.

See Also

Concepts

Configuration Manager Software Distribution
Software Distribution Setup and Configuration
About the Configuration Manager Site Control File
How to Read and Write to the Configuration Manager Site Control File by Using Managed Code
How to Read and Write to the Configuration Manager Site Control File by Using WMI
SMS_SCI_Component Server WMI Class