Re-Triggering a ConfigMgr Application Install

Ok, so let’s say you’ve deployed an Application in ConfigMgr, but you’re testing the Application – making sure that it works, that it installs correctly.  If it does, great.  But then you make some changes on the target client and you want to install it again to make sure that it still works, without making any changes to the Application itself.

For testing installations, I usually make Available deployments so that I can run them again if they fail.  But if the Application has installed correctly and you want to run it again, you can’t do that from the Software Center, as the Application will only have the option to Uninstall.

I guess the long way is to remove it from the targeted collection, refresh the policy on the client, add it to the collection again, refresh the client policy again.

But surely there must be something quicker?  Indeed there is 🙂  Using WMI, you can simply call the Install method for the Application in the CCM_Application class.

Here’s how with PowerShell:

$ComputerName = "PC001"
$AppName = "Microsoft Office 2013 Pro"

$s = New-PSSession -ComputerName $ComputerName
Invoke-Command -Session $s -Argu $ComputerName,$AppName -ScriptBlock `
param ($ComputerName,$AppName)
write-host "Getting Parameters for '$AppName' on $ComputerName"
$App = Get-WmiObject -computername $ComputerName -Namespace "root\ccm\ClientSDK" -Class CCM_Application | where {$_.Name -like "$AppName"} | Select-Object Id, Revision, IsMachineTarget
$AppID = $App.Id
$AppRev = $App.Revision
$AppTarget = $App.IsMachineTarget
write-host $AppID, $AppRev, $AppTarget -ForegroundColor Yellow
write-host "Triggering Installation!" -ForegroundColor Green
([wmiclass]'ROOT\ccm\ClientSdk:CCM_Application').Install($AppID, $AppRev, $AppTarget, 0, 'Normal', $False) | Out-Null
Remove-PSSession $s

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.