Past Due Applications Not Installing in SCCM 2012

Jim Riekse and I recently collaborated on a solution to an issue involving newly imaged workstations installing applications via CM 2012. The problem seems to occur on applications targeted at the client that have passed their deadline for installation. In the Software Center on the client the applications show a status of “Past due – will be installed” but they never actually install. The DCMAgent.log shows the following applicable entries which imply a successful install even though nothing gets installed.

PopulateCIsFromAssignment: past deadline, set CCM_CONTENT_WF_DEADLINE_DOWNLOAD flag, 0x10000a
CDCMAgentJob::HandleEvent(Event=Transition, CurrentState=Success)

Jim identified two workarounds for this issue:

  1. Within the CM 2012 console, change each application scheduled or deadline time
  2. Manually go to each computer's Software Center and click the Install button for the applications that are 'past due'

Both of these workarounds require a significant amount of time to implement, especially if there are a lot of new machines and applications being deployed. We decided it would be best to automate a solution. We came up with a PowerShell script that can be scheduled to run on a regular basis. The script connects to a site server and loops through every deployment with a deadline and increments it by one minute IF the deadline occurs in the past. Simply run this script on a machine that has the CM 2012 SP1 console installed and specify a site code that you have connected to in the past with that console.

Syntax

.\IncrementCMDeploymentStartTime.ps1 –SiteCode <EnterYourSiteCode>

Example: .\IncrementCMDeploymentStartTime.ps1 –SiteCode CAS

Code

 Param(            
    [parameter(Mandatory=$true)]            
    $SiteCode
    )

Write-Host "SCCM 2012 SP1 Deadline Time Increment Script"
Write-Host "Version 1.0"
Write-Host "Parameters"
Write-Host "  SiteCode: "$SiteCode -ForegroundColor Green

function GetCMSiteConnection
{
  param ($siteCode)

  $CMModulePath = Join-Path -Path (Split-Path -Path "${Env:SMS_ADMIN_UI_PATH}" -ErrorAction Stop) -ChildPath "ConfigurationManager.psd1"
  Import-Module $CMModulePath -ErrorAction Stop
  $CMProvider = Get-PSDrive -PSProvider CMSite -Name $siteCode -ErrorAction Stop
  CD "$($CMProvider.SiteCode):\"
  return $CMProvider
}

#Main

#Connect to SCCM, must have SCCM Admin Console installed for this to work
#If this fails then connect with the console to the site you want to use, then open PowerShell from that console
$CM = GetCMSiteConnection -siteCode $SiteCode
Write-Host "Connected to:" $CM.SiteServer
Write-Host 
Write-Host "---Updating Deployments---"

foreach ($Deployment in (Get-CMDeployment))
{
  if (($Deployment.EnforcementDeadline -lt (Get-Date).ToUniversalTime()) -and ($Deployment.EnforcementDeadline -ne $null))
  {
    Set-CMApplicationDeployment -Application (Get-CMApplication -Id $Deployment.CI_ID) -CollectionName $Deployment.CollectionName -DeadlineDate ($Deployment.EnforcementDeadline).AddMinutes(1) -DeadlineTime ($Deployment.EnforcementDeadline).AddMinutes(1)
    Write-Host "  "$Deployment.AssignmentID"CI Deadline Updated" -ForegroundColor Green
  }
  else
  {
    Write-Host "  "$Deployment.AssignmentID"CI Skipped, deadline time occurs in the future or not specified" -ForegroundColor Red
  }
}

IncrementCMDeploymentStartTime.renametops1