Skip to content

Commit 7d2b5b3

Browse files
committed
Update New-SCCMTSAppVariable
1 parent 2c3b3ff commit 7d2b5b3

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

SCCM-New-SCCMTSAppVariable/New-SCCMTSAppVariable.ps1

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,26 @@
3131

3232
BEGIN
3333
{
34-
$TSEnv = New-Object -COMObject Microsoft.SMS.TSEnvironment
34+
# Create an TaskSequence Environment Object
35+
$TaskSequenceEnvironment = New-Object -COMObject Microsoft.SMS.TSEnvironment
3536
}
3637
PROCESS
3738
{
3839

39-
$ApplicationCount = $ApplicationList.Count
40+
# Create a Counter
4041
$Counter = 1
4142

43+
# Foreach Application we create an incremented variable
4244
$ApplicationList | ForEach-Object {
45+
46+
# Define the Variable Name
4347
$Variable = "$BaseVariableName{0:00}" -f $Counter
44-
$TSEnv.value("$Variable") = "$_"
4548

46-
$Counter++| Out-Null
49+
# Create the Task Sequence Variable
50+
$TaskSequenceEnvironment.value("$Variable") = "$_"
51+
52+
# Increment the counter
53+
[void]$Counter++
4754
}
4855
}
4956
}

0 commit comments

Comments
 (0)