For a customer implementing Configuration Manager 2012 the use of the Application Catalog and Software Center can be a big change for the end-users. This when they have not used SCCM software and/or user-portal centric delivery before.
I was looking for possibilities to create a situation to start an application deployment with a more common interface like the start menu or the desktop.
Since the startmenu is back in modern OS-versions to deliver the apps for the user I decided to try and use it for this.
To automate it I have created a simple script that will create shortcuts you can use to start the deployment. On the background it uses Configuration Manager Client SDK WMI Classes
It’s not being used in production, so it is not completely functional with user rights but it was much easier to create than I expected. So use this at you own risk and make it better yourself :).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#========================================================================== # NAME: Populate-App-Shortcuts.ps1 # AUTHOR: Ariën de Groot - ADG ICT Solutions # DATE : 20-10-2015 # COMMENT: Script will check for deployments from the app-model # and create a shortcut for every result. #========================================================================== # Get available deployed apps that are not installed from WMI Class CCM_Application $AvailableApplications = Get-WmiObject -Class ccm_application -Namespace root\ccm\clientsdk | Where-Object { ($_.InstallState -ne "Installed") -and ($_.ApplicabilityState -eq "Applicable") -and ($_.IsMachineTarget -eq $False) } Remove-Item "$env:APPDATA\Microsoft\Windows\Start Menu\Available Apps\*.*" | Where { ! $_.PSIsContainer } If($AvailableApplications) { $AvailableApplications.FullName | ForEach-Object { $ShortcutName = $_ # Create a Shortcut with Windows PowerShell $TargetFile = "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe" $TargetArguments = '-ExecutionPolicy Bypass -WindowStyle Hidden -File C:\Deploy-CCM_App.ps1 -ApplicationName "' + $ShortcutName + '"' $ShortcutFile = "$env:APPDATA\Microsoft\Windows\Start Menu\Available Apps\$ShortcutName.lnk" $WScriptShell = New-Object -ComObject WScript.Shell $Shortcut = $WScriptShell.CreateShortcut($ShortcutFile) $Shortcut.Arguments = $TargetArguments $Shortcut.TargetPath = $TargetFile $Shortcut.Save() } } |
The code should explain itself because it’s not that difficult. You can play with the Get-WmiObject and the Where-Object options to test your exact results.
This creates (for example) a shortcut to install Mozilla Firefox with the target:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File C:\Deploy-CCM_App.ps1 -ApplicationName "Mozilla Firefox (nl)"
This script can be repeated by using something like scheduled tasks:
The deployment then also needs a small Powershell script to start:
This part I have found on Nickolaj’s blog and is being explained there.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
#========================================================================== # NAME: Deploy-CCM_Apps.ps1 # AUTHOR: Ariën de Groot - ADG ICT Solutions # DATE : 20-10-2015 # COMMENT: Script will call ClientSDK method to install Application provided by parameter ApplicationName. # Original code from Nickolaj Andersen (Uninstall an Application in Software Center with PowerShell) # http://www.scconfigmgr.com/2014/01/14/uninstall-an-application-in-software-center-with-powershell/ #========================================================================== param ( [string]$ApplicationName ) $ComputerName = $env:COMPUTERNAME $ApplicationClass = [WmiClass]"\\$($ComputerName)\root\ccm\clientSDK:CCM_Application" $Application = Get-WmiObject -Class ccm_application -Namespace root\ccm\clientsdk | Where-Object { ($_.Name -eq "$ApplicationName") -and ($_.AllowedActions -eq "Install") -and ($_.InstallState -ne "Installed") } $ApplicationID = $Application.Id $ApplicationRevision = $Application.Revision $ApplicationClass.Install($ApplicationID,$ApplicationRevision,$false,0,"High",$false) |
For the install to work propery, make sure you have one deployment for ‘Install’ per application per user. This would be the case most of the time in environments I have (seen).
Clicking on the shortcut [in the startmenu] will trigger the normal installation as it would when you use the Software Center!
Applications deployed to users but made available, unfortunately have to be chosen from the Application catalog first. I will try to get these to deploy with a shortcut by the user also later. [Edit: solved here]
Leave A Comment