single advertisement for multiple programs sccm

Posted on 2011-10-10
Last Modified: 2012-08-14
i am fairly new to SCCM and have manged to get it up and running.

I have created a software package, with has 3 programs for the package:

program 1 - runs the .msi with a a silent switch
program 2 - applies a regedit key
program 3 - runs a batch file that copies a file from remote share to local folder

Is there a way to create a single advertisment that will run and distribute all 3 programs in a sequence ??? At the moment it seems i can only create 1 advertisement per program, which seems kind of silly, meaning i have create 3 advertisements to run 3 programs for a single package.

I had a look at the task sequencing but that is to do with boot images and Os deployment.

Question by:lansol
    LVL 31

    Assisted Solution

    Two possibilities:

    1. In the program properties of "program 3" goto Advanced Tab and configure the option "Run another program first" with "program 2". Do the same on the "program 2" program properties for "program 1". Then advertise "program 3" to a collection

    2. Create a Custom Task Sequence and insert some "Install Software" steps in order. There are no boot images needed.
    New --> Task Sequence --> "Create a new custom task sequence"
    LVL 23

    Expert Comment

    by:Nagendra Pratap Singh
    A: You can include all the in batch file, this is the simplest. I can give you sample for such a batch file if you need it.

    B: You can add the registry contents in the .msi

    C: You can merge the .reg in the msi and include a custom action in th .msi for file copies.

    Author Comment

    hey nspingh123 that would be awesome.

    do i need a 3rd party program to merge the reg keys entries to the.msi?
    LVL 23

    Accepted Solution

    Here they go.


    Batch file 1, this installs remotely, for sccm you may ignore the start path that uses psexec.exe but it may help when you want to run things immediatley w/o using SCCM or when you don't have sccm installed

    ======================Cut here====================

    @echo off

    REM Below line is to install the PowerShell in silent mode
    psexec.exe -accepteula @serverlist.txt cmd /c \\fileserver1\C$\myapp.x86.v5.5.4.743\Microsoft.Powershell.1.0.Package\windowsserver2003-kb926139-v2-x86-enu.exe /quiet

    REM Below line is to set the PowerShell ExecutionPolicy to RemoteSigned
    psexec.exe -accepteula @serverlist.txt -u DOMAIN\user -p P@ssw0rd cmd /c "echo . | powershell Set-ExecutionPolicy RemoteSigned | powershell Get-ExecutionPolicy"

    REM Below line is to install the myapp in silent mode with the default options
    psexec.exe -accepteula @serverlist.txt -u DOMAIN\user -p P@ssw0rd cmd /c msiexec.exe /i \\fileserver1\myapp.x86.v5.5.4.743\myappSetup_x86.msi /quiet

    psexec.exe -accepteula @serverlist.txt -u DOMAIN\user -p P@ssw0rd cmd /c msiexec.exe /i \\fileserver1\myapp.x64.v5.5.4.743\myappSetup_x64.msi /quiet

    REM Below line copies the config file to the bin directory. Please change the source and destination paths accordingly
    psexec.exe -accepteula @serverlist.txt -u DOMAIN\user -p P@ssw0rd cmd /c copy \\fileserver1\configfiles\myapp.exe.config "C:\Program Files\myapp\bin"

    REM Below line starts the myapp services
    psexec -accepteula @serverlist.txt -u DOMAIN\user -p P@ssw0rd cmd /c net start myservice

    ===================Cut here=================================

    Batch file 2
    This uses multiple files (stage.cmd and postinst.cmd,) but uses parameters to be passed on to the .msi and is quite flexible.\
      here registry is applied in postinst( to point people to Boston or NJ servers) but you may merge it all in one


    =============================================CUT HERE======================================================
    @echo off
    rem ---------------------------------------------------------
    rem STAGE.CMD - standard entry point for launching software
    rem If PreInst.CMD or PostInst.CMD are present, STAGING.CMD
    rem will call them before and after MSIEXEC.EXE respectively
    rem If PreInst.CMD or PostInst.CMD detect fatal errors they
    rem must set the ERRORLEVEL > 0.
    rem Note that the %LOGFILE% environment variable is
    rem visible to child processes of STAGING.CMD, so PreInst.CMD
    rem and PostInst.CMD can log their progress here too
    rem ---------------------------------------------------------

    rem ---------------------------------------------------------
    rem Define key global variables
    rem MSIFILE - MSI file name
    rem LOGFILE - Log file for STAGING.CMD
    rem MSILOG  - Log file for MSIEXEC.EXE
    rem ---------------------------------------------------------
    set BaseAppName=Bloomberg_BTSG3_UI_9.14
    set BaseAppLoggingName=%BaseAppName%_b01
    set here=%~dp0
    cd %here%

    set LOGDIR=%SystemRoot%
    if exist %TMP% set LOGDIR=%TMP%
    if exist C:\Winnt\SGLogs set LOGDIR=C:\Winnt\SGLogs
    if exist %SystemRoot%\Debug\Apps set LOGDIR=%SystemRoot%\Debug\Apps

    set MSIFILE=%BaseAppName%.MSI
    set LOGFILE=%LOGDIR%\%BaseAppLoggingName%.LOG
    set MSILOG=%LOGDIR%\%BaseAppLoggingName%_MSIEXEC.LOG

    rem ---------------------------------------------------------
    rem Log startup
    rem ---------------------------------------------------------
    .\writelog -s%BaseAppName% -tI "Beginning installation of %BaseAppLoggingName%"
    echo Beginning installation of %BaseAppLoggingName% > %LOGFILE%

    rem ---------------------------------------------------------
    rem Run pre-installation script if present
    rem ---------------------------------------------------------
    set ERRORMESSAGE=PreInst.CMD returned an error
    if exist PreInst.CMD call PreInst.CMD %3 %4 %5 %6 %7 %8 %9
    if errorlevel 1 goto ERROR

    rem ---------------------------------------------------------
    rem Invoke MSI
    rem ---------------------------------------------------------
    set ERRORMESSAGE=MSIexec.exe returned an error

    MSIEXEC /I %MSIFILE% REBOOT=ReallySuppress ROOTDRIVE="C:\" SOURCELIST="\\Winpkgsrc1\xpapps\%BaseAppLoggingName%;\\Winpkgsrc2\xpapps\%BaseAppLoggingName%;\\Winpkgsrc3\xpapps\%BaseAppLoggingName%;\\Winpkgsrc4\xpapps\%BaseAppLoggingName%" ALLUSERS=1 /L*V %MSILOG% /qb-! ADDLOCAL=ALL %3 %4 %5 %6 %7 %8 %9
    if %errorlevel% == 3010 goto REBOOT
    if errorlevel 1 goto ERROR
    goto POSTINST

    echo MSIEXEC returned exit code 3010 which means that a reboot is required to complete installation >> %LOGFILE%

    rem ---------------------------------------------------------
    rem Run post-installation script if present
    rem ---------------------------------------------------------
    set ERRORMESSAGE=Postinst.cmd returned an error
    if exist PostInst.CMD call PostInst.CMD %3 %4 %5 %6 %7 %8 %9
    if errorlevel 1 goto ERROR

    rem ---------------------------------------------------------
    rem Clean-up and exit
    rem ---------------------------------------------------------
    .\writelog -s%BaseAppName% -tS "Installation of %BaseAppLoggingName% complete"
    echo Installation of %BaseAppLoggingName% complete >> %LOGFILE%
    set STATUS=Complete
    goto END

    .\writelog -s%BaseAppName% -tE "An error occured during the installation of %BaseAppLoggingName%"
    echo An error occured during the installation of %BaseAppLoggingName% >> %LOGFILE%
    set STATUS=Error

    echo [EndOfInstallation] >> %LOGFILE%
    echo Status=%STATUS% >> %LOGFILE%
    if not "%ERRORMESSAGE%" == "" echo ErrorMessage=%ERRORMESSAGE% >> %LOGFILE%

    =======================================Cut here===========
    =======================================Cut here===========

    @echo off

    .\tools\RegDACL.exe "HKLM\SOFTWARE\Bloomberg L.P." /GGU:F(CI)
    .\tools\RegDACL.exe "HKLM\SOFTWARE\Bloomberg L.P." /GGT:F(CI)

    .\tools\xcacls.exe "C:\program files\Blp\btsg3" /Y /T /G users:c administrators:f system:f everyone:c

    reg import BO2.reg
    reg import NJ2.reg

    =======================================Cut here===========

    Author Comment

    wow pretty full

    thanks very much for that!

    Featured Post

    The problems with reply email signatures

    Do you wish that you could place an email signature under a reply? Well, unfortunately, you can't. That great Exchange/Office 365 signature you've created will just appear at the bottom of an email chain. What a pain! Is there really no way to solve this? Well, there might be...

    Join & Write a Comment

    Are you having trouble running ADPREP on your current 32-bit Domain Controller? Have you ran ADPREP multiple times on your Domain but still get an error stating you have not prepared your Domain yet? Here is a change that gets even the most seaso…
    With the higher take up rate of SAN’s, virtualisation etc, windows devices with more than one network interface are becoming more common.  As a general rule when a service that is installed on a Windows operating system is running, it only listens o…
    This tutorial will show how to push an installation of Backup Exec to an additional server in both 2012 and 2014 versions of the software. Click on the Backup Exec button in the upper left corner. From here, select Installation and Licensing, then I…
    This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now