Multi-Software Install Wrapper

Yesterday, I released a script, Install-Wrapper.ps1, that allows you to do more with a SCCM Application Deployment then just a single task. The Install-Wrapper script will only run a single application install and yes you could modify the scrip to do more but I found it much easier to use another script. The Multi-Software Install Wrapper script allows you to plug the Install-Wrapper script into it and install software in an order or stop the process if an install fails.

The only part of the script  you need to modify to use it is under the variables to set section of the script. The $Installs variable is where you will enter the name of the Install-Wrapper scripts that are to be part of this application deployment. Again the Install-Wrapper script should be in the same content folder as the Multi-Software Install Wrapper script. The other variable, $ExitOnFail will determine if the script should stop if the other install scripts fail. If you want the script to stop on an error change $ExitOnFail to $True.

Then just like with the Install-Wrapper script you create an application for the script. You will use the following for the install command.

Powershell.exe -ExecutionPolicy Bypass -NoProfile -File Multi-Install-Wrapper.ps1

Install software with SCCM

This Scrip it meant to be used with my Install-Wrapper Script. You can get that script from

This script will allow you to install multiple peaces of software. To use the script first create 
a script for each of your software installs using the Install-Wrapper script. Then add each script 
name to the Installs variable in the order they need to be installed in. Then if you need the script 
to stop if an install fails change the ExitOnfail variable to $True.

Created By: Kris Gross
Twitter: @kmgamd

You can get updates to this script and others from here

#Variables to set
#Do not use spaces in the filenames
$Installs = "Install-1.ps1","Install-2.ps1","Install-3.ps1"
#Change this to $True if you wan the script to stop if one of the $Installs fails
$ExitOnFail = $False

$Computername = $env:computername
$CCMPath = "$ENV:windir\CCM"
$MiniNTPath = "$env:SystemDrive\MININT\SMSOSD"
$CCMPath = "$env:windir\ccm"
$PublicDesktop = "$env:PUBLIC\Desktop"
$ScriptName = $MyInvocation.MyCommand.Name
$LogFile = "$CCMPath\Logs\ConfigMgrOps.log"

$OSType = Get-WmiObject -Class Win32_OperatingSystem | Select-Object -ExpandProperty OSArchitecture
If ($OSType -eq "64-bit") {$WinSysFolder = "SysWow64"} Else {$WinSysFolder = "System32"}
$Returncode = 0

function New-LogFile() 
    $LogFilePaths =  "$LogFile", "$MiniNTPath\Logs\ConfigMgrOps.log","$env:TEMP\ConfigMgrOps.log"
    Foreach ($LogFilePath in $LogFilePaths) 
        $script:NewLogError = $null
        $script:ConfigMgrLogFile = $LogFilePath
        Add-LogEntry "Log file successfully intialized for $ScriptName." 1
        If (-Not($script:NewLogError)) { break }
    If ($script:NewLogError) 
        $script:Returncode = 1
        Exit $script:Returncode
function Add-LogEntry ($LogMessage, $Messagetype) 
    # Date and time is set to the CMTrace standard
    # The Number after the log message in each function corisponts to the message type
    # 1 is info
    # 2 is a warning
    # 3 is a error
    Add-Content $script:ConfigMgrLogFile "<![LOG[$LogMessage]LOG]!><time=`"$((Get-Date -format HH:mm:ss)+".000+300")`" date=`"$(Get-Date -format MM-dd-yyyy)`" component=`"$ScriptName`" context=`"`" type=`"$Messagetype`" thread=`"`" file=`"powershell.exe`">"  -Errorvariable script:NewLogError

function Exit-Script() 
    Add-LogEntry "Closing the log file for $ScriptName." "1"
    Add-LogEntry "******************************************************************************************************************************************************" "1"
    Exit $script:Returncode    

function Install-Software
    forEach ($Install in $Installs)
        Add-LogEntry "Starting Install $Install" "1"
        Invoke-Expression .\"$Install"
        IF ($ExitOnFail)
            IF ($LASTEXITCODE -NE 0)
                Add-LogEntry "ERROR: $Install Failed" "3"


Popular posts from this blog

SCCM Task Sequence GUI - How to set up the TS to work with a GUI

SCCM Applications vs. SCCM Packages: Understanding the Key Differences

How to Deploy a Windows 10 Servicing update as a Application