How to View Available Programs on a Configuration Manager Client
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 available programs on a Configuration Manager 2007 client by using the resource manager (UIResourceMgrClass) object GetAvailableApplication method to get a Programs collection.
To view the available programs on a Configuration Manager client
Get the Configuration Manager client resource manager object (UIResourceMgrClass).
From the UIResourceMgrClass object, call GetAvailableApplications to get a Programs collection of available programs.
Loop through the Programs collection to display each Program.
Example
The following example method displays a list of available programs.
For information about calling the sample code, see How to Call Configuration Manager COM Automation Objects.
Sub ShowPrograms
On Error Resume Next
Dim oUIResource
Dim oPrograms
Dim oProgram
Set oUIResource = CreateObject ("UIResource.UIResourceMgr")
If oUIResource Is Nothing Then
wscript.echo "Could not create Resource Object - quitting"
Exit Sub
End If
Set oPrograms = oUIResource.GetAvailableApplications
If oPrograms Is Nothing Then
wscript.echo "Failed to get programs object - quitting"
Set oUIResource=Nothing
Exit Sub
End If
wscript.echo "There are " & oPrograms.Count & " programs"
wscript.echo
For Each oProgram In oPrograms
WScript.Echo "Program Name: " & oProgram.FullName
WScript.Echo " Comments: " & oProgram.Comments
WScript.Echo " Package ID: " & oProgram.PackageId
WScript.Echo
Next
Set oProgram=Nothing
Set oUIResource=Nothing
End Sub
public void ShowPrograms()
{
try
{
UIResourceMgrClass uiResMgr = new UIRESOURCELib.UIResourceMgrClass();
Programs progs = uiResMgr.GetAvailableApplications();
Console.WriteLine("There are " + progs.Count + " programs");
Console.WriteLine();
foreach (ProgramCls prog in progs)
{
Console.WriteLine("Program Name: " + prog.FullName);
Console.WriteLine(" Comments: " + prog.Comments);
Console.WriteLine(" Program ID: " + prog.Id);
Console.WriteLine(" PackageID: " + prog.PackageId);
}
}
catch (COMException e)
{
Console.WriteLine("Exception occurred: " + e.Message);
throw;
}
}
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
Program Class
Programs Class
How to Call Configuration Manager COM Automation Objects