Permalink
Switch branches/tags
Nothing to show
Find file Copy path
7d2b5b3 Sep 5, 2015
1 contributor

Users who have contributed to this file

56 lines (43 sloc) 1.3 KB
Function New-SCCMTSAppVariable
{
<#
.SYNOPSIS
Function to create a SCCM Task Sequence Application Variable during the OSD
.PARAMETER BaseVariableName
Specifies the "Base Variable Name" present in the task "Install Application" of the Task Sequence.
(In the 'Install application according to dynamic variable list' section)
.PARAMETER ApplicationList
Specifies the list of application to install.
Those must match the SCCM Application name to install
.EXAMPLE
New-SCCMTSVariable -BaseVariableName "FX" -ApplicationList "Photoshop","AutoCad"
.EXAMPLE
New-SCCMTSVariable -BaseVariableName "FX" -ApplicationList $Variable
.NOTES
Francois-Xavier Cat
www.lazywinadmin.com
@lazywinadm
#>
PARAM ([String]$BaseVariableName,
[String[]]$ApplicationList
)
BEGIN
{
# Create an TaskSequence Environment Object
$TaskSequenceEnvironment = New-Object -COMObject Microsoft.SMS.TSEnvironment
}
PROCESS
{
# Create a Counter
$Counter = 1
# Foreach Application we create an incremented variable
$ApplicationList | ForEach-Object {
# Define the Variable Name
$Variable = "$BaseVariableName{0:00}" -f $Counter
# Create the Task Sequence Variable
$TaskSequenceEnvironment.value("$Variable") = "$_"
# Increment the counter
[void]$Counter++
}
}
}