Prerequisites
- Sccm Client Center
- Deployment id , package id ,program
- Windows PowerShell(by default)
- 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
- Add - Type - Path 'C:\SCCM Client Center\smsclictr.automation.DLL'
- $strcomp = Get - Content "C:\computers.txt"
- $strcomp | where {
- test - connection $_ - quiet - count 1
- } | ForEach - Object {
- $ReRun = New - Object - TypeName smsclictr.automation.SMSClient($_)
- $ReRun.SoftwareDistribution.RerunAdv("<Deploymentid>", "<PackageID>", "<PROGRAMNAME>")
- }
Exceptions
This script will fail to execute in the below scenarios,
- WMI Corrupted
- Access denied on target machines
- RPC issues
- When deployment is not targeted