Partilhar via


How to View the Software Distribution Advertised Programs Client Agent Settings

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 Microsoft System Center Configuration Manager 2007, you view the Configuration Manager 2007 software distribution advertised programs client agent settings by using the resource manager (UIResourceMgrClass) object GetSWDistSettings method.

To view the software distribution advertised programs client agent settings

  1. Get the Configuration Manager client resource manager object (UIResourceMgrClass).

  2. From the UIResourceMgrClass object, call GetSWDistSettings to get the client's software distribution settings.

Example

The following example method gets the Configuration Manager client software distribution agent settings.

For information about calling the sample code, see How to Call Configuration Manager COM Automation Objects.

Sub AgentSettings

    On Error Resume Next

    Dim oUIResManager 
    Dim oSWDist 

    Set oUIResManager = createobject("UIResource.UIResourceMgr")

    If oUIResManager Is Nothing Then
        Wscript.Echo "Couldn't create Resource Manager - quitting"
        Exit Sub
    End If

    Set oSWDist=oUIResManager.GetSWDistClientSettings()

    If oSWDist Is Nothing Then
        Set oUIResManager=Nothing
        Wscript.Echo "Couldn't get software distribution information - quitting"
        Exit Sub
    End If

    Wscript.Echo "Program countdown duration:   " & FormatNumber (oSwDist.UserPreemptionCountdown,0) & " seconds"
    Wscript.Echo "User input timeout:           " & FormatNumber (oSwDist.UserPreemptionTimeout/60,0) & " minutes"
    Wscript.Echo "Content Location Timeout:     " & FormatNumber (oSwDist.ContentLocationTimeout,0) & " seconds"

    If oSwDist.DisplayNewProgramNotification=1 Then
        Wscript.Echo "New program notification:     Enabled"
    Else 
        Wscript.Echo "New program notification:     Disabled"
    End if

    If oSWDist.SWDistEnabled=1 Then
        Wscript.Echo "Software distribution:        Enabled"
    Else
        Wscript.Echo "Software distribution:        Disabled"
    End if

    Wscript.Echo "What's new dialog duration:   " & FormatNumber (oSwDist.WhatsNewDuration,0) & " seconds"

    Set oSWDist=Nothing 
    Set oUIResManager=Nothing

End Sub
public void AgentSettings()
{
    UIResourceMgrClass uiResMgr = new UIRESOURCELib.UIResourceMgrClass();

    SWDistClientSettings swDistSettings = uiResMgr.GetSWDistClientSettings();

    Console.WriteLine("Program countdown duration:   " + swDistSettings.UserPreemptionCountdown.ToString() + " seconds");
    Console.WriteLine("User input timeout:           " + (swDistSettings.UserPreemptionTimeout/60).ToString() +  " minutes");
    Console.WriteLine("Content Location Timeout:     " + swDistSettings.ContentLocationTimeout.ToString() + " seconds");

    if (swDistSettings.DisplayNewProgramNotification==1)
    {
        Console.WriteLine("New program notification:     Enabled");
    }
    else 
    {
        Console.WriteLine("New program notification:     Disabled");
    }
    
    if (swDistSettings.SWDistEnabled == 1)
    {
        Console.WriteLine("Software distribution:        Enabled");
    }
    else
    {
        Console.WriteLine("Software distribution:        Disabled");
    }

    Console.WriteLine("What's new dialog duration:   "  + swDistSettings.WhatsNewDuration.ToString() + " seconds");

}

The example method has no parameters.

Compiling the Code

This C# example requires:

Namespaces

System

System.Collections.Generic

System.Text

System.Runtime.InteropServices

UIRESOURCELib

COM Reference

UIResource 1.0 Type Library

Robust Programming

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

Security

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

See Also

Concepts

How to Configure the Software Distribution Advertised Programs Client Agent Cache
How to Run a Program on a Configuration Manager Client
Configuration Manager Client Automation
Software Distribution Client Control Panel Automation
UIResourceMgr Class
How to Call Configuration Manager COM Automation Objects
SWDistClientSettings Class