This great post from the ConfigMgr Team provides some details on how you can customise the Application Catalog to better meet your requirements:
The Application Catalog in System Center 2012 Configuration Manager allows users to browse, request, and install software that you make available to them. You might be wondering if you can tailor the Application Catalog capabilities to better suit your business requirements. The answer is yes, and this post provides some examples.
The Application Catalog website role includes the ASP.NET web service that runs alongside the catalog web page. This service supports Application Catalog operations, such as retrieving the list of applications or submitting application request.
At this time only the following operations are supported:
Note that other operations are not currently supported even if they are exposed in the service contract of the Application Catalog Website.
The first step is to configure the web service to publish its interface so that connecting clients can use the service. To do that, locate the web.config file in the root of the physical folder for the Application Catalog website. The folder might appear in one of the following locations, based on your configuration:
- <drive>:Program FilesSMS_CCMCMApplicationCatalog
Find the “webServices” section in web.config:
Modify web.config to delete <remove name=”Documentation”> node:
Then you can get the service reference from the following source (assuming the default virtual name for the Application Catalog website role):
– where <myserver> is the server hosting the Application Catalog website role.
If you are using Visual Studio, you can add a service reference to the Application Catalog, as shown in the following screenshot:
You should now be able to call the available service methods from your project. In this example, the soap client class will be generated under the “ApplicationCatalogService” namespace.
Example: Retrieving the List of Available Applications Using Web Service
After you have created the service reference, you can call the web service methods to retrieve the list of categories and applications available to the user. Note that only the applications available in the Application Catalog will be returned.
Similarly, the following service call will retrieve the list of applications represented as AppDetailView objects:
In this case the Application Catalog will return the first 20 applications, sorted by Name.
Note that the Application Catalog website role requires Windows Authentication. Without impersonation, the soap client will pass information by using the current user context.
Example: Retrieving the Application List and Submitting Application Request with Windows PowerShell
The next example shows how to create a script by using Windows PowerShell to submit the application request. Note that this example does not include the functionality necessary to provide the approval dialog box after the application is approved.
I recommend that you use the handy New-WebServiceProxy cmdlet in Windows PowerShell 2.0 to create a service reference on the fly, as follows:
# Create web service proxy
$catalogurl = "http://myserver/CMApplicationCatalog";
$url = $catalogurl+"/ApplicationViewService.asmx?WSDL";
$service = New-WebServiceProxy $url -UseDefaultCredential;
You can then call the service to retrieve the list of applications. For simplicity, this example picks the first application from the list. Alternatively, the application ID can be retrieved using SMS Provider or the Application Catalog. Note that the Application ID parameter for the Application Catalog methods does not have the version information.
# Retrieve the first 20 applications sorted by name
# Sample app id: "ScopeId_82A46150-9A71-421A-9645-AD4B92AF1B72/Application_295530ae-5755-48fc-a04b-c01c9631c1f7"
$total = 0;
$apps = $service.GetApplications("Name",$null,"Name","",20,0,$true,"PackageProgramName",$false,$null,[ref]$total)
$appid = $apps.ApplicationId;
When the user requests an application from the Application Catalog, the device information is used to validate and track the request. Here is how you can retrieve device information by using WMI on the client computer:
# Retrieve device id to identify the machine
$clientsdk = [wmiclass]'root/ccm/clientSDK:CCM_SoftwareCatalogUtilities';
$deviceidobj = $clientsdk.GetDeviceID();
$deviceid = $deviceidobj.ClientId+","+$deviceidobj.SignedClientId;
Next, device information with the request reason is sent to the Application Catalog:
# Submit application request to the server
$reason = "Test request reason";
$reqresult = $service.RequestApplicationForUser($reason, $appid, $deviceid, $null);
Example: Approving the Application Request with Windows PowerShell
To perform an administrative action on the pending request, first connect to the SMS Provider. Note that you must have application approver privileges for the following operations:
# Retrieve provider info, assumes one provider
$siteserver = "MySiteServer"
$provider = gwmi -ComputerName $siteserver -namespace "rootsms" -query "SELECT * FROM SMS_ProviderLocation";
$prov_machine = $provider.Machine;
$sitecode = $provider.SiteCode;
$namespace = "rootsmssite_"+$sitecode;
Next, run a query to find the request object for the application. This example then approves all pending requests for this application. Note that approval cannot be reverted. Also, the delete operation is not supported on the SMS_UserApplicationRequest object.
Although it’s not needed for this particular operation, I’ve included an example of querying for the specific SMS_Application object:
# get the list of pending requests for this application and approve for all users
$wmiquery = "SELECT * FROM SMS_Application WHERE ModelName = '"+$appid+"' AND IsLatest='TRUE'";
$adminapp = gwmi -ComputerName $prov_machine -namespace $namespace -query $wmiquery;
$wmiquery = "SELECT * FROM SMS_UserApplicationRequest WHERE ModelName = '"+$appid+"'";
$adminrequests = gwmi -ComputerName $prov_machine -namespace $namespace -query $wmiquery;
foreach ($request in $adminrequests)
$res = $request.Approve("Approved via Windows PowerShell");
If the user browses to the Application Catalog, the request for this application will be marked as Approved.
For security purposes, make sure that you revert any changes that you made to the web.config file when you no longer require WSDL publishing for the web service.
– The Application Catalog website role provides a service layer that helps extend the Application Catalog
– SMS Provider exposes APIs to approve or deny application requests
– The operations shown in this blog post can be written in the language of your choice, including Windows PowerShell
I hope that this information helps you to extend the Application Catalog functionality. For more information about the Application Catalog and System Center 2012 Configuration Manager extensibility, see Configuring the Application Catalog and Software Center in Configuration Manager in the System Center 2012 Configuration Manager Documentation Library on TechNet, and System Center 2012 Configuration Manager SDK in the MSDN Library.
This posting is provided “AS IS” with no warranties, and confers no rights.