Share via


PowerShell: Export all ConfigMgr 2012 R2 task sequences

Here's a quick script that will export all of your task sequences in ConfigMgr 2012 R2:

]----code

Import-Module 'F:\Program Files\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1'
CD 'F:\Program Files\Microsoft Configuration Manager\AdminConsole\bin'
CD CM0:       #Change 'CM0' to your site code

$ts = Get-CMTaskSequence

foreach ($t in $ts){

     $path = "F:\TaskSequenceBackups"

     $exportname = $t.Name +".zip"

     Export-CMTaskSequence -TaskSequencePackageId $t.PackageID -ExportFilePath "$path\$exportname"

     }

code----[

Change the file paths in the first two lines to match your CM installation directory. Change the Site Code to your site code. Change the $path variable to your export destination.

You may get errors during the export process if the Task Sequence name has a colon in the name such as: "Testing: Win8.1 Refresh". Change any colons to a dash to avoid errors.

Hope this helps.

Comments

  • Anonymous
    May 11, 2017
    The comment has been removed
    • Anonymous
      June 13, 2017
      It should be your site code. Updated script to reflect that. Thanks.