Automate your software installs.  PassiveInstall  is a free Windows PowerShell module that creates a framework suitable to your needs in automating the installation without a costly MSI repackaging operation.

Write simple PowerShell scripts that can control and improve upon the software as delivered to you by the software vendor. The framework provides simple cmdlets that perform most of the typical tasks you may need to perform without having to worry about some of the peculiarities of writing in PowerShell.  Spend your time wisely and end up with application installs with the best end-user experience from a feature and performance perspective.

New in V2.9.0.0:

  • Patch to Approve-PassiveElevation to handle return code when script exists with no code or user closes window early.

New in V2.8.0.0:

  • Made improvements to documentation and code around Approve-PassiveElevation. If the elevated user does not have access to external shares/mapped drives the script is on, error reporting on this situation is now more clear as to what the issue is and what to do about it.  Commonly seen in situations where the machine is not domain joined but shares are.
  • Upgraded to .Net 4.8
  • Upgaded Installer technology from Wix-based installer to AdvancedInstaller.

New in V2.7.0.0:

  • Made fixes to Disable-PassiveWindowsServices to stop service first if needed.

New in V2.5.0.0:

  • Added -CurrentUser switch to New-PassiveDesktopShortcut and made the cmdlet consistent with others by defaulting to the public user's desktop.
  • Fixes for Remove-PassiveRegistryItem.
  • Module now advertises correct version.

New in V2.1.0.0:

  • Added pause/resume to Start-PassiveSleep.
  • Added Overwrite switch parameter to Copy-PassiveFolder
  • Fix bug in New-PassiveDesktopShortcut to write new shortcut to correct location.
  • Add support in Remove-PassiveDesktopShortcuts and Remove-PassiveStartMenuShortcuts for URL style shortcuts.
  • Documentation updates

New in V2.0.1.0:

  •  Updated documentation on GitHub
  •  Small fix for copy-PassiveFolder

New in V2.0.0.0:

  •  Code release on GitHub
  •  Show-PassiveTimer added to provide an interruptible count down timer at the end of your script so that you can review the output.
  •  WhatIf and Confirm supported added to all cmdlets that make changes.
  •  Small fixes, such as for Remove-PassiveDestopShortcuts to also handle shortcuts that were written to the Public Desktop.

Example Usages:

  • Let's say that you want to add an additional file to the install.  The proper way to do that in PowerShell requires that you test for the existence of each directory in the folder path of your intended destination and create the folder if not present before copying the file or the copy will fail.  The Copy-PassiveFile cmdlet lifts you of that burden.
  • Lets say that you want to install an msi, patch it with a msp, import a registry file, and run a cmd or powershell script, and finally extract a bunch of files from a zip archive.  With PassiveInstall, you just call the Install-PassiveFile cmdlet with each file.  If the command needed arguments, like "/qn", you add those to the line as well.  No need to remember the full syntax on how to call the command line to use each file type, PassiveInstall does the work for you!
  • Even better, when used in conjunction with the App-V Sequencer and our AppV_Manage tool, you can automatically generate improvement scripts to fix many of the common shortcomings of vendor installers based on an analysis of how it installed.

Example Script:

Here is an example script used to install and configure Trimble SketchUp Viewer:

# PassiveInstall.ps1
#
# Copyright 2017 TMurgent Technologies, LLP
#
#
# PURPOSE:
#    Automates a custom installation of an application as either a passive or silent installation.
#    This script can be further modified to add registry settings or add dependencies.
##########################################################################################################################

#----------------------------------------------------------------------------------
# Standard coding starting here (DO NOT MODIFY)
# Get folder that this PS1 file is in so that we can find files correctly from relative references
$executingScriptDirectory = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent

# Bring in common utility code
Import-Module "C:\Program Files\WindowsPowerShell\Modules\PassiveInstall\PassiveInstall.dll"

#If here, we are (now) running as an admin!
#---------------------------------------------------------------------------------

#==================================================================================
#                    MAKE CUSTOMIZATIONS HERE
$AppName = 'Trimble_SketchupViewer'
$InstallerLogFolder = "c:\Users\Public\Documents\SequencedPackage"
$InstallerLogFile = $InstallerLogFolder+'\Log_'+$AppName+'_MainInstaller.txt'
$DoSilent = 0  #Set to 1 for silent instead of passive

function Run_CustomInstall
{   
    if ($DoSilent -eq 1)
    {
        Install-PassiveInstallFile -Installer "$($executingScriptDirectory)\vcredist_14\vcredist_x64.exe" -Arguments '/q'-DoSilent
        Install-PassiveInstallFile -Installer "$($executingScriptDirectory)\SketchUpViewer2019-x64.msi" -Arguments '/qn DISABLEADVTSHORTCUTS=1' -DoSilent
    }
    else
    {
        Install-PassiveInstallFile -Installer "$($executingScriptDirectory)\vcredist_14\vcredist_x64.exe" -Arguments '/q'
        Install-PassiveInstallFile -Installer "$($executingScriptDirectory)\SketchUpViewer2019-x64.msi" -Arguments '/qn DISABLEADVTSHORTCUTS=1'
    }
    Copy-PassiveFile -Source "$($executingScriptDirectory)\PrivatePreferences.json" -Destination "$($env:LOCALAPPDATA)\SketchUp\SketchUp 2019\Sketchup"
    Remove-PassiveDesktopShortcuts -Names 'SketchUp Viewer.lnk'

    if ($DoSilent -eq 1)
    {
        Optimize-PassiveNgenQueues  -DoSilent
    }
    else
    {
        Optimize-PassiveNgenQueues
    }
}
#                   end of CUSTOMIZATION area
#=================================================================================
#  Do NOT Modify below this line

New-PassiveFolderIfNotPresent $InstallerLogFolder
if ($DoSilent -eq 1)
{
    Set-PassiveWinSize 10 7 5 5 -Title 'PowerShell - PassiveInstall.ps1' -DoSilent
    # Ensure we are running elevated
    Approve-PassiveElevation -AsAdmin
}
else
{
    Set-PassiveWinSize 80 40 5 5 -Title "PowerShell - PassiveInstall.ps1 $($AppName)"
    Set-PassiveWinColors  -Background 'DarkGray' -Foreground 'White' 

    # Ensure we are running elevated
    Approve-PassiveElevation -AsAdmin

    Set-PassiveWinSize  100 44 10 10 -Title "[Elevated] PowerShell - PassiveInstall.ps1 $($AppName)"
    Set-PassiveWinColors  -Background 'DarkGray' -Foreground 'White'
   
    Write-host 'Starting - PassiveInstall.ps1'
}

#If here, we are (now) running as an admin!
#---------------------------------------------------------------------------------

$err = Run_CustomInstall *>&1
if ($DoSilent -ne 1)
{
    Write-Output $err
}
Write-Output $err >> $InstallerLogFile

#---------------------------------------------------------------
#                  Standard wrapup area (DO NOT MODIFY)
write-host -ForegroundColor "Green"  "Done."
Show-PassiveTimer 20000 "End of script, P to pause for timer, when paused Q to quit the timer, any other key to resume."
Start-Sleep 20
#                    end
#---------------------------------------------------------------

 

For additional information:

 

At The Learning Site @ TMurgent we have a online course to help get you introduced to the PassiveInstall tool.  The online course if free, and will show you how to install the module, how to learn more about each of the available cmdlets, and a lab that you can perform on your own to create your first customized installation script.  We also show the integration with the AppV_Manage tool to automatically generate an improvement for a vendor application.

The Application Book is a great book that was written by Tim Mangan for the IT Professionals that deal with installing and customizing applications and desktops.  The book is a sort of reversal of the Windows API; relating the artifacts of installation that you find when running an installer to understand the purpose of what the vendor was trying to do.  You can find more information about the book and purchase a paperback book or e-book from the website as well. Anyone doing involved with application delivery in a Microsoft environment needs this book!

 

Download here: SetupPassiveInstall-2.9.0.0.zip.