Skip to content

Commit 5780c80

Browse files
committed
Add New-SCCMTSAppVariable
1 parent ffa2b33 commit 5780c80

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
Function New-SCCMTSAppVariable
2+
{
3+
<#
4+
.SYNOPSIS
5+
Function to create a SCCM Task Sequence Application Variable during the OSD
6+
7+
.PARAMETER BaseVariableName
8+
Specifies the "Base Variable Name" present in the task "Install Application" of the Task Sequence.
9+
(In the 'Install application according to dynamic variable list' section)
10+
11+
.PARAMETER ApplicationList
12+
Specifies the list of application to install.
13+
Those must match the SCCM Application name to install
14+
15+
.EXAMPLE
16+
New-SCCMTSVariable -BaseVariableName "FX" -ApplicationList "Photoshop","AutoCad"
17+
18+
.EXAMPLE
19+
New-SCCMTSVariable -BaseVariableName "FX" -ApplicationList $Variable
20+
21+
.NOTES
22+
Francois-Xavier Cat
23+
www.lazywinadmin.com
24+
@lazywinadm
25+
#>
26+
27+
PARAM ([String]$BaseVariableName,
28+
29+
[String[]]$ApplicationList
30+
)
31+
32+
BEGIN
33+
{
34+
$TSEnv = New-Object -COMObject Microsoft.SMS.TSEnvironment
35+
}
36+
PROCESS
37+
{
38+
39+
$ApplicationCount = $ApplicationList.Count
40+
$Counter = 1
41+
42+
$ApplicationList | ForEach-Object {
43+
$Variable = "$BaseVariableName{0:00}" -f $Counter
44+
$TSEnv.value("$Variable") = "$_"
45+
46+
$Counter++| Out-Null
47+
}
48+
}
49+
}

0 commit comments

Comments
 (0)