Thursday, February 2, 2012

SCCM 2012 – Deploy multiple applications using Dynamic Variables in Task Sequence


Description
A key requirement while deploying OSD based task sequences is to deploy applications after the image is deployed. This is a key requirement especially when we deploy role based applications or business unit based applications at the end of the image

 

Solution
The best way to accomplish this is by utilizing dynamic variables in SCCM 2012. In this feature of SCCM you can deploy Virtual Applications and MSI based applications using dynamic variables.

 

This is how we can utilize this feature:

 

Step1: Create a collection and add an array of collection variables e.g.:
  1. APP01 = .NET 4.0
  2. APP02 = APP-V 4.6
  3. APP03 = Adobe Reader App-V Package
  4. APP04 = SCEP2012
  5. APP05 = Adobe Flash
  6. APP06 = SNAP-IT
Note:
  • Each variable must start with a common name and have 01, 02, 03 … and so on....appended to the variable name
  • The values of these variables is the application name and not application deployment types or package ids




Step2: Create a task sequence and add the task – "Install Applications", select "Install Applications according to dynamic variable list" and add the Base Variable Name as APP



 
Note: 
  • Only the base name of the variable must be used e.g. APP in this case


Step 3: Deploy the task sequence on the collection. All applications will get deployed in a sequence based on the numbering of the collection variables

16 comments:

  1. Like the post, I just have a couple questions. Can you use multiple variable prefixes in a collection.
    Such as CORE01 for a set of Core Applications.
    FLD01 for a set of required Applications on laptops.
    Is there a limit to the amount of variables you can have in the list? The Install Applications in a task sequence is limited 9 in SCCM 2012.

    ReplyDelete
    Replies
    1. hi,

      You can not have multiple variables in the same collection variable. If you use CORE then your vars need to be CORE01, CORE02 and so on.

      The best way to segregate deployment of core apps on all devices and applications on laptops is using collections

      There is no documented limit to the number of apps that can be deployed using task sequence variables... however as a best practice I recommend deploying only core apps and business apps using this method. User based apps should be deployed using deployments on collections

      Delete
    2. I stand corrected..you can have multiple variables in the same collection. And each of the collection variables can be invoked appropriately using a Task sequence

      Delete
  2. So you have to deploy the TS to the collection with those variables, or can you deploy your TS to any collection and it just refers to that collection with the variables?

    ReplyDelete
    Replies
    1. hi Adam,

      See at the end of the day, there are 2 things we need to take care:

      1) Collection variable
      2) Reference of the collection variable in the advertisement

      let me explain with the help of cases:

      Case 1 -
      If the collection variable is VAR001, VAR002, VAR003 and the advertisment also has VAR as the references.
      The advertisment will work seamlessly here.

      Case 2-
      If the collection variable is VAR001, VAR002, VAR003 and the advertisment also has APP as the references.
      The advertisment will error out.

      Therefore if we are deploying a TS with a particular variable reference then the collection must have the same collection variable. To answer your questrion, you can deploy 1 TS containing variable VAR to as many collections that will have collection variables starting with VAR and the applciations will deploy seamlessly.

      Delete
  3. There is a very good article from "Michael niehaus" on removing the dependency on variables http://blogs.technet.com/b/mniehaus/archive/2008/05/08/using-the-configmgr-2007-install-software-step-to-install-a-dynamic-list-of-packages.aspx

    ReplyDelete
  4. You sure can have multiple basevariables attached to one collection. But you need 1 install application step per base variable in your task sequence.

    And as you correctly use double digits for your apps the limit is obviously 99 applications per variable.

    The example with 3 digits was for ConfigMgr 2007 were 3 digits was the way it was done. Was shifted to 2 in CM12 and hence the 3 digit cases won't work.

    Kim Oppalfens

    ReplyDelete
  5. I can't get this to work, I'm getting error 0x80004005 when running a task sequence to deploy application based on variables.

    Application named "Oracle_InstantClient_11.2_WinAll_x86_v1.0" - Checkbox "Allow this application to be deployed from the install application task sequence.." checked.

    Collection "APPDist-Oracle_InstantClient_11.2_x86_WinAll_v1.0" - based on AD-group membership (has my test computer in it). Collection variables "DA001" value "Oracle_InstantClient_11.2_WinAll_x86_v1.0" (application name)

    Task sequence "APPDist-Test" - install applications according to.. base variable DA, checkbox "if an application install fails..". This task sequence is deployed "install/available" to my test computer.


    Regards,

    Andreas

    ReplyDelete
    Replies
    1. Hi Andreas,

      Error 80004005 in a task sequence can be because of multiple reasons.. Can you please share the smsts.log and I can have a look at the issue.

      Delete
    2. The reason the deployment is failing is probably because your application name has special characters in it.

      Remove the special characters from the application name and try again.

      Delete
    3. Are you saying that the dashes (-), underscores (_) and periods (.) are invalid in an Application Name?

      Delete
  6. This is a great post - thanks for sharing!
    So lets say I add 15 applications initially but later delete applications 3, 7 and 12, and the corresponding variable of course.
    This leaves the application numbering with some gaps: 1-2, 4-6, 8-11 & 13-15
    When I run the TS, will it fail because it cannot find APP03, APP07, APP12?

    ReplyDelete
  7. My hope is that I have been looking at this too long and it is something simple. :)
    a) TS is configured to install packages with base variable: COREAPPS
    b) As you will see in the below logs, collection variables are COREAPPS001=packageID:program
    c) Programs are configured with "Allow this program to be installed......without being deployed (just being lazy here in typing)

    Now the blurb from smsts, I look forward to your thoughts regarding failure to install!! Many thanks!!
    Executing command line: smsswd.exe /pkg: /install /basevar:COREAPPS /continueOnError:True TSManager 3/30/2014 8:09:41 AM 2252 (0x08CC)
    [ smsswd.exe ] InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    PackageID = '' InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    BaseVar = 'COREAPPS', ContinueOnError='True' InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    ProgramName = '' InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    SwdAction = '0003' InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    DSInstaller::Execute() InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    Setting progress step for initialization InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    Setting total steps to 1 InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    Succeeded loading resource DLL 'C:\Windows\CCM\1033\TSRES.DLL' InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    Env variable with specified basename COREAPPS and suffix '001' is found. InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    Initializing Dynamic install action InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    PackageId = CM100040 , ProgramName = Zip, PolicyId = SMS10000-CM100040-85110AB4 InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    Added CM100040:"Zip" to the install list InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    PackageId = CM10003C , ProgramName = Reader, PolicyId = SMS10000-CM10003C-7A512DA9 InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    Added CM10003C:"Reader" to the install list InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    PackageId = CM100041 , ProgramName = Firefox, PolicyId = SMS10000-CM100041-772B93BB InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    Added CM100041:"Firefox" to the install list InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    Adding 3 installs to steps InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    Setting total steps to 4 InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    CLibSMSMessageWinHttpTransport::Send: URL: myserver.domain.com:80 CCM_POST /ccm_system/request InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    Request was successful. InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    Decompression (zlib) succeeded: original size 346, uncompressed size 992. InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    Request client ID: d3c2af69-5e35-40ce-b0bf-9a794911acf3 InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    Response client ID: d3c2af69-5e35-40ce-b0bf-9a794911acf3 InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    Retrieving Policy Assignments: InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    assignmentList.size() > 0, HRESULT=80004005 (e:\nts_sccm_release\sms\client\osdeployment\installsoftware\dsutils.cpp,610) InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    No matching policy assignments received. InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    Policy download failed, hr=0x80004005 InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    dsUtil.DownloadPolicies(), HRESULT=80004005 (e:\nts_sccm_release\sms\client\osdeployment\installsoftware\dsinstaller.cpp,243) InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    dsInstaller.Execute(), HRESULT=80004005 (e:\nts_sccm_release\sms\client\osdeployment\installsoftware\main.cpp,344) InstallSoftware 3/30/2014 8:09:41 AM 1300 (0x0514)
    Process completed with exit code 2147500037 TSManager 3/30/2014 8:09:42 AM 2252 (0x08CC)
    Failed to run the action: Install Core App Packages.
    Unspecified error (Error: 80004005; Source: Windows) TSManager 3/30/2014 8:09:42 AM 2252 (0x08CC)

    ReplyDelete
    Replies
    1. I got the same error as you ... :(

      Delete
    2. Same here...however is it possible that the Deployment is not using an MSI or App-V? Is this possibly a Certificate Issue?

      Quote from Sandeep Chadda: "......you can deploy Virtual Applications and MSI based applications using dynamic variables"

      Delete
    3. Us COREAPPS01 instead of 001

      Delete