How to Configure a Package to Use Binary Delta Replication

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

The following example shows how to configure an existing package to use binary delta replication, in Microsoft System Center Configuration Manager 2007, by using the SMS_Package Server WMI Class class and the PkgFlags class property.

To configure an existing package to use binary delta replication

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

  2. Load the existing package object using SMS_Package Server WMI Class class.

  3. Modify the PkgFlags property using the hexadecimal value for AP_USE_BINARY_DELTA_REP.

  4. Save the package and the new package properties.

Example

The following example method configures an existing package to use binary delta replication.

Important

The hexadecimal values that define the PkgFlags property are listed in the SMS_Package Server WMI Class class reference material.

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

Sub ModifyPackageToUseBinaryDeltaReplication(connection, existingPackageID)
    
    ' Define a constant with the hex value for AP_USE_BINARY_DELTA_REP. 
    AP_USE_BINARY_DELTA_REP = &H04000000
    
    ' Get the specific advertisement instance to modify. 
    Set packageToModify = connection.Get("SMS_Package.PackageID='" & existingPackageID & "'")
    
    ' List the existing property values.
    Wscript.Echo " "
    Wscript.Echo "Values before change: "
    Wscript.Echo "--------------------- "
    Wscript.Echo "Package Name:   " & packageToModify.Name
    Wscript.Echo "Package Flags:  " & packageToModify.PkgFlags
    
    ' Set the new property value.
    packageToModify.PkgFlags = packageToModify.PkgFlags OR AP_USE_BINARY_DELTA_REP
    
    ' Save the advertisement.
    packageToModify.Put_ 
    
    ' Output the new property values.
    Wscript.Echo " "
    Wscript.Echo "Values after change: "
    Wscript.Echo "--------------------- "
    Wscript.Echo "Package Name:   " & packageToModify.Name
    Wscript.Echo "Package Flags:  " & packageToModify.PkgFlags

End Sub
public void ModifyPackageToUseBinaryDeltaReplication(WqlConnectionManager connection, string existingPackageID)
{
    // Define a constant with the hex value for AP_USE_BINARY_DELTA_REP. 
    const Int32 AP_USE_BINARY_DELTA_REP = 0x04000000;

    try
    {
        // Get the specific package instance to modify. 
        IResultObject packageToModify = connection.GetInstance(@"SMS_Package.PackageID='" + existingPackageID + "'");

        // List the existing property values.
        Console.WriteLine();
        Console.WriteLine("Values before change:");
        Console.WriteLine("_____________________");
        Console.WriteLine("Package Name:  " + packageToModify["Name"].StringValue);
        Console.WriteLine("Package Flags: " + packageToModify["PkgFlags"].IntegerValue);

        // Modify the PkgFlags value to include the AP_USE_BINARY_DELTA_REP value.
        packageToModify["PkgFlags"].IntegerValue = packageToModify["PkgFlags"].IntegerValue | AP_USE_BINARY_DELTA_REP;

        // Save the package with the new value.
        packageToModify.Put();

        // Reload the package to verify the change.
        packageToModify.Get();

        // List the existing (modified) property values.
        Console.WriteLine();
        Console.WriteLine("Values after change:");
        Console.WriteLine("_____________________");
        Console.WriteLine("Package Name:  " + packageToModify["Name"].StringValue);
        Console.WriteLine("Package Flags: " + packageToModify["PkgFlags"].IntegerValue);
    }
    catch (SmsException ex)
    {
        Console.WriteLine("Failed to modify package. Error: " + ex.Message);
        throw;
    }
}

The example method has the following parameters:

Parameter Type Description

Connection

swbemServices

  • Managed: WqlConnectionManager

  • VBScript: SWbemServices

A valid connection to the SMS Provider.

existingPackageID

  • Managed: String

  • VBScript: String

The ID of the existing package.

Compiling the Code

The C# example requires:

Namespaces

System

System.Collections.Generic

System.ComponentModel

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 Packages
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
SMS_Package Server WMI Class