I have used this script many times now in many different versions and I thought it was time to share an example on what can be achieved with a vbscript. It can be used to display information to the user and let the used postpone the Installation/Upgrade a number of times, check for running processes and more.

The following features exist in this example and can be seen as an example on what can be done, so adjust it to fill your needs. A HTA to display more information is one example of an enhancement, adding more processes to check another.

The script is run using the “Run this program before” feature and can be used both for Programs and for Task Sequences.

Functions:

  • Prompt the user that an installation/upgrade is about to be performed.
  • Allow the user to postpone the installation/upgrade of an application x amount of times. If the user postpones the installation the script will return exit code 1 and SCCM will assume it failed and not continue depending program or task sequence.
  • After x amount of times postponed the script will start the installation anyway.
  • Countdown timer
  • Check that the process specified is closed if not prompt the user to close it.

Screenshots of how it will look at the client:

prerun3

If the user press Cancel:

prerun4

If the Process specified is running:

prerun5

Usage:

  • Download the script: http://ccmexec.com/wp-content/uploads/2011/09/Prerun1.txt
  • Create a Package in SCCM containing the prerun1.vbs file
  • Create a Program with a command line for executing the script, for example:
    “wscript.exe prerun1.vbs Excel Excel.exe”
  • Configure the settings under environment according to the example below.

prerun1

  • For the Application you want to use it to install configure it to run the Prerun1 program before like this:prerun2
  • Then advertise it as you normally would and try it out!

I hope this can has showed a new example of what can be done using Configuration Manager and a little bit of scripting.