-
Notifications
You must be signed in to change notification settings - Fork 326
Expand file tree
/
Copy pathImport-TaskSequence.ps1
More file actions
38 lines (30 loc) · 1.03 KB
/
Import-TaskSequence.ps1
File metadata and controls
38 lines (30 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
param (
[string]$SiteCode,
[string]$TaskSequenceName,
[string]$InputFile
)
#########
# What does it do?
# Script imports a previously "exported" TaskSequence from CM12 to CM12
#
# Howto: Extract the TaskSequence with the following command:
# (Get-CMTaskSequence | where-object {$_.Name -eq $NameOfTaskSequence}).Sequence | Out-File $PathToExportFile
# This will be your $InputFile
#
# Author: David O'Brien, david.obrien@sepago.de
# Created: 28.09.2012
# Prerequisites:
# - Microsoft System Center Configuration Manager 2012 SP1 (beta)
# - ConfigMgr Powershell to get your existing TaskSequence
#
#########
$Class = "SMS_TaskSequencePackage"
$Instance = $null
$TS = $null
$NewSequence = $null
$TS = [wmiclass]"\\.\root\sms\site_$($SiteCode):$($Class)"
$Instance = $TS.CreateInstance()
$SequenceFile = Get-Content $InputFile
$NewSequence = $Ts.ImportSequence($SequenceFile).TaskSequence
$Instance.Name = "$TaskSequenceName"
$NewTSPackageID = $TS.SetSequence($Instance, $NewSequence).SavedTaskSequencePackagePath