Scenario: I wanted to package the Office 365 Activation Troubleshooter (Officeact.diagcab) for Office 365 users with activation issues. I needed to find out the commands to use as well as the appropriate Detection Method.
1. Download: Officeact.diagcab https://aka.ms/diag_officeact
2. Create a PowerShell (Diagnostics.Office365.ps1) script to call the officeact.diagcab file. See example below
3. Create an SCCM Script application calling the Diagnostics.Office365.ps1 script
powershell -ExecutionPolicy Bypass .\Diagnostics.Office365.ps1
Select the Detection Method tab and select radial next to "Use a custom script to detect the presence of the this deployment type".
Select the Edit option on the right and set the script type to PowerShell and the script content as appropriate to the application.
The script below will look at all running processes and filter out all processes that equal msdt; if a process matching this string is found the client will return an exit code of 0 (zero) indicating to SCCM that the application has been detected.
Once the process terminates at the end of the diagnostics process the SCCM Client Application deployment cycle action will rerun making the application available for installation again without issuing a failed message.
The User Experience Tab should be set to "Install for User" as this diagcab must be run interactive in order to process the diagnostics. The installation program visibility should be set to Hidden otherwise the initial PowerShell script will be displayed detailing the Transcript etc.