Task Sequence Install Multiple APPS

To install the multiple software’s(Packages) based on the AD group Name. We need to have A VB script and one Database .DAT file Create a package with the Vbscript & APP.Dat files. and the Program command line is “wscript AppAutomationv0.1.2.7.vbs” Below is the VBScript: save as AppAutomationv0.1.2.7.vbs ‘Application Automation Version 1.0.1
‘AppSetup will be the base value Dim FileGroupArray
Dim AA00
Dim strGroups, colGroups
Dim objcomputer, Currentcomputer
Dim configMgrEnv
Dim logFilename, logPath, logFile,LGText
Dim EnvGet On Error Resume Next Init()
‘This function connects to the SMS environment and creates Log path .
‘This also creates a Task sequence variable .
Function Init()     ‘Get the ConfigMgr Environment
    Set configMgrEnv = createObject(“Microsoft.SMS.TSEnvironment”)
    ‘Set the log file path depending on whether the context is a Task Sequence or not
    If configMgrEnv = 0 Then
        logPath = configMgrEnv(“Temp”)
    Else
        logPath = configMgrEnv (“_SMSTSLogPath”)
    End If   
    ‘Open the log file and append to it, create if it doesn’t exist
    Const ForWriting = 2
    Set LGText = CreateObject(“Scripting. FileSystemObject”)
    Set logFile = LGText.OpenTextFile(logPath & “” & logFilename, ForWriting,True)
End Function    Set objcomputer = CreateObject(“ADSystemInfo”)
Set Currentcomputer = GetObject(“LDAP://” & objcomputer.computerName)
colGroups = Currentcomputer.memberOf
If IsEmpty(colGroups) Then
   strGroups = “”
   ElseIf TypeName(colGroups) = “String” Then
      strGroups = LCase(colGroups)
   Else
      strGroups = LCase(Join(colGroups,”;”))
End If ‘ Read a Comma Separated Text and Comparing with Group Membership
Dim PackId
Dim ProgName
Dim AppId
Dim tsVar
Const ForReading = 1
Count=1
baseVar=”AppSetup00″ Set objFSO = CreateObject(“Scripting.FileSystemObject”)
Set objTextFile = objFSO.OpenTextFile(“APP.dat”, ForReading) Do While objTextFile.AtEndOfStream <> True
    strLine = objTextFile.ReadLine
    If inStr(strLine, “”) Then
        arrTextRecord = split(strLine, “;”)
        If IsEmpty(Groups) Then
            Groups = arrTextRecord(0)
             For Each Group In colGroups
                 If LCase(Group)= LCase(arrTextRecord(0)) Then
                  tsVar = baseVar &  Count
                   AppId = arrTextRecord(1) & “:” & arrTextRecord(2)
                       If configMgrEnv <> 0 Then
                        configMgrEnv (tsVar) = AppId
                    End If      
                 Else
                 End If
            Next        
        Else
            Groups = Groups & “;”&  arrTextRecord(0)
             For Each Group In colGroups
                 If LCase(Group)= LCase(arrTextRecord(0)) Then
                    tsVar = baseVar &  Count
                       AppId = arrTextRecord(1) & “:” & arrTextRecord(2)
                       If configMgrEnv <> 0 Then
                        configMgrEnv (tsVar) = AppId
                    End If
                    Count = Count+1   
                     If Count>9 Then
                       baseVar=”AppSetup0″
                     End if   
                 Else
                 End If
            Next        
        End If
       End If
Loop WScript.Quit   Open Notepad and save as APP.Dat file  with below text, you should have the below format for installing the software’s : Format should be below: distinguished name of the AD Group Name;PackageID:ProgramName CN=Microsoft_Visio_Viewer_2010_INSTALL,OU=Software Distribution,OU=OS Deployment,OU=Win7Deployment,DC=Test,DC=com;CEN00175;Per-system unattended
CN=Microsoft_RSAT_INSTALL,OU=Software Distribution,OU=OS Deployment,OU=Win7Deployment,DC=Test,DC=com;CEN0017E;Microsoft_RSAT_Install
CN=Microsoft_Project_2007_STD_INSTALL,OU=Software Distribution,OU=OS Deployment,OU=Win7Deployment,DC=Test,DC=com;CEN00178;Microsoft_Project_2007_STD_Install   and below is the screenshot of the TaskSeqence Step: We need to have two steps one for Populate the List of target apps for that system and second one for installing the apps SNAGHTML113065f Second Step in the TS: Install Multiple Applications image Note: we no need to add anything in the Options for above two steps

Leave a Comment