Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
You set the Software Updates client branding information, in Configuration Manager, by modifying the necessary site control file settings.
To set software updates client branding information
Set up a connection to the SMS Provider.
Make a connection to the Client Agent section of the site control file by using the SMS_SCI_ClientComp class.
Loop through the array of available properties, making changes as needed.
Commit the changes to the site control file.
Example
The following example sets the Software Updates client branding information by using the SMS_SCI_ClientComp class to connect to the site control file and change properties. This example changes the Software Updates subheading information displayed in the client user interface in notifications or reminders.
For information about calling the sample code, see Calling Configuration Manager Code Snippets.
Sub SetSUMBranding(swbemServices, _
swbemContext, _
siteCode, _
brandingText)
' Load 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: SUMBrandingSubTitle
If vProperty.PropertyName = "SUMBrandingSubTitle" 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
End Sub
public void SetSUMClientBranding(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'");
// Load the embedded properties into a temporary copy.
Dictionary<string, IResultObject> tempEmbeddedProperties = clientAgent.EmbeddedProperties;
// Update the branding information with the string variable passed in.
tempEmbeddedProperties["SUMBrandingSubTitle"]["Value1"].StringValue = brandingText;
// Replace the embedded properties object with the temporary copy.
clientAgent.EmbeddedProperties = tempEmbeddedProperties;
// 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. |
swbemContext |
- VBScript: SWbemContext |
A valid context object. For more information, see How to Add a Configuration Manager Context Qualifier by Using WMI. |
siteCode |
- Managed: String- VBScript: String |
The site code. |
brandingText |
- Managed: String- VBScript: String |
The text to replace the branding text in the site control file. |
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.
.NET Framework Security
For more information about securing Configuration Manager applications, see Configuration Manager role-based administration.
See Also
About Software Updates 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 How to Add a Configuration Manager Context Qualifier by Using WMI