Create an OS Deployment Task Sequence in Configuration Manager 2012 with PowerShell

This code is designed to create the framework for the Windows 8.1 OSD Task Sequence used in Chapter 11 of “Learn ConfigMgr 2012 in a Month of Lunches“.

The PowerShell cmdlet doesn’t perform the full amount of customisation which the reader does in the book’s lab environment, but it sets up the structure of the Task Sequence quite well, leaving very little post-script customisation to perform.

You can download the script directly from

# Define Configuration Manager variables
$CMSiteCode = 'P01'
$CMSiteServer = ''
$CMNameSpace = "rootSMSsite_$CMSiteCode"
# 1.0 Get Deployment Objects
$BootImageID = (Get-CMBootImage -Name 'Custom Boot Image (x64)').PackageID
$OSImageID = (Get-CMOperatingSystemImage -Name 'Windows 8.1 x64 Enterprise Gold').PackageID
$ClientPackageID = (Get-CMPackage -Name 'Configuration Manager Client Package').PackageID
# 1.1 Create Task Sequence
New-CMTaskSequence -InstallOperatingSystemImageOption `
  -TaskSequenceName 'Deploy Windows 8.1 x64 Enterprise' `
  -BootImagePackageId $BootImageID `
  -OperatingSystemImagePackageId $OSImageID `
  -OperatingSystemImageIndex '1' `
  -ClientPackagePackageId $ClientPackageID `
  -JoinDomain DomainType `
  -DomainName '' `
  -DomainAccount 'MOLCM_JD' `
  -DomainPassword 'P@ssw0rd' `
  -DomainOrganizationUnit 'LDAP://OU=Workstations,OU=SCCMR2Lab,DC=mol,DC=sccmlab,DC=net' `
  -PartitionAndFormatTarget $true `
  -LocalAdminPassword 'P@ssw0rd'

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>