How To Re-Run A Failed Deployment On Multiple Machines(SCCM)

Prerequisites

  1. Sccm Client Center
  2. Deployment id , package id ,program
  3. Windows PowerShell(by default)
  4. List of machines.

There is a scenario where 15 percent of machine applications failed due to run time exceed error. The application uninstalled the older version but it doesn’t install the latest versions and throws an error as run time exceeded even though the maximum run time was extended to 45 mins.

The 15 percenr is almost 800 machines but the rest of the machines were able to receive and get the application deployed successfully.

While the deployment\advertisement was re-run via sccm client center, the application was successfully deployed. Hence I planned to automate the re-run task for 800 machines and it works like a charm

Solutions

I hope most of us have seen the dll file in SCCM Client Center folder which is the core for this application.

Powershell has the capability of working with dll files.

 
Script
  1. Add - Type - Path 'C:\SCCM Client Center\smsclictr.automation.DLL'  
  2. $strcomp = Get - Content "C:\computers.txt"  
  3. $strcomp | where {  
  4.     test - connection $_ - quiet - count 1  
  5. } | ForEach - Object {  
  6.     $ReRun = New - Object - TypeName smsclictr.automation.SMSClient($_)  
  7.     $ReRun.SoftwareDistribution.RerunAdv("<Deploymentid>""<PackageID>""<PROGRAMNAME>")  
  8. }  

Exceptions

This script will fail to execute in the below scenarios,

  1. WMI Corrupted
  2. Access denied on target machines
  3. RPC issues
  4. When deployment is not targeted