Infrastructure – System Center Configuration Manager – “Deploying applications with the PowerShell Application Deployment Toolkit”

The Issue

Recently I was posed a question where a customer wanted their users to experience a more advanced or informative when software gets installed. They also required that data be saved so that users work are not affected.

Requirements: The Mimecast for Outlook add in had to be installed (This requires Outlook to close) but users should be clearly warned to save data and then re open Outlook after completion (or instruct user to re open).

The Investigation

Option 1: System Center Configuration Manager “Run another program first”.

My first attempt was to create a Powershell Pop Up and turn that into a package that could run using the ConfigMgr feature “Run another program first” to warn users to close Outlook and save data. This Pop up we had to specify the time it waits which means for slower machines it would not wait long enough and faster machines it waited too long. Although the worked to an extent, I was not yet satisfied with the end product.

Run Another Program First
Timer Pop Up
During Install
After Install

PowerShell Code below:

#.\PopupTimer.ps1 -Mimecastlocation

param (
    $MimecastLocation
    )

#script for balloon notification
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$objNotifyIcon = New-Object System.Windows.Forms.NotifyIcon

#script to pop up window
$wshell = New-Object -ComObject Wscript.Shell 
$wshell.Popup("Mimecast needs to close Outlook to install the latest add in. Please save all your work. Outlook will close automatically in 5 minutes",0,"Done",0x1)

#wait for user to close outlook
Wait-Event -Timeout 300

#force outlook to close
Stop-Process -Name 'OUTLOOK'

#wait before mimecast install
Wait-Event -Timeout 30

#pop up balloon notification
$objNotifyIcon.Icon = ".\Mimecast_M_2015.ico"
$objNotifyIcon.BalloonTipIcon = "Info"
$objNotifyIcon.BalloonTipText = "Do Not Open OUTLOOK while Mimecast is installing"
$objNotifyIcon.BalloonTipTitle = "Install Mimecast Add-In"
$objNotifyIcon.Visible = $true
$objNotifyIcon.ShowBalloonTip(5)

#Run msi to install mimecast
Invoke-Command -ScriptBlock {cmd /c msiexec.exe /i ".\Mimecast_for_outlook_7_7_x64.msi" /qn} 

#Balloon Pop up for completion
$objNotifyIcon.BalloonTipText = "You can now open OUTLOOK"
$objNotifyIcon.BalloonTipTitle = "Install Mimecast Add-In was successful"
$objNotifyIcon.Visible = $true
$objNotifyIcon.ShowBalloonTip(5)

#wait after mimecast install
Wait-Event -Timeout 30

#start up Outlook
Start-Process 'OUTLOOK'

Option 2: The PowerShell Application Deployment Toolkit (PSappDeployToolkit)

This neat little toolkit that can be downloaded from https://psappdeploytoolkit.com/ surpassed my expectations when it comes to capabilities, features and design. It has an amazing manual that I will be quoting for the sake of this post.

Extract the Package

Extract the toolkit
Copy the MSI required for installation

Modify the PowerShell

Edit the Deploy-Application.ps1
Fill in details [line 64 – 72]
Fill in Options [line 121]
Fill in Options [line 141] [line 151]
Fill in Options [line 161] [line 181]

Create the ConfigMgr Application (PSAppDeploymentToolkit Admin Guide)

Create the application

Deploying the application

The Resolution (User Experience)

Summary

  1. Download and extract the PSAppDeployToolkit from: https://psappdeploytoolkit.com/
  2. Modify the PowerShell
  3. Create the ConfigMgr Application
  4. Deploy to your customers

As always, I hope this has been informative and feel free to correct me in any steps.

Author