You are here:   Research
  |  Login

Welcome to my blog, quickest way to find articles is usually to search for them.

Search in All Title Contents

Creating Task Sequences in ConfigMgr via PowerShell

Dec 07 2017

ConfigMgr 1710 has even more PowerShell cmdlets for creating and editing task sequences compared to ConfigMgr 1706.

34 more to be exact, growing them from 75 to 109 (including alias names because I was lazy :) ).

Tip: You might also want to check out some of the PowerShell samples from Ari Saastamoinen (@AriSaastamoinen) on his blog:



Here is a short sample to create a new custom task sequence with two groups, and two run command line actions:


# Create a new Task Sequence
$TS = New-CMTaskSequence -CustomTaskSequence -Name "Create TS Via PowerShell"

# Create the first group
$Group1 = New-CMTaskSequenceGroup -Name "First Group" 
Add-CMTaskSequenceStep -InsertStepStartIndex 0 -TaskSequenceName $TS.Name -Step $Group1

# Create the first Run Command Line action
$Step1 = New-CMTaskSequenceStepRunCommandLine -StepName "Run Command 1" -CommandLine "cmd.exe /c"
Set-CMTaskSequenceGroup -TaskSequenceName $TS.Name -StepName $Group1.Name -AddStep $Step1 -InsertStepStartIndex 0

# Create the second group
$Group2 = New-CMTaskSequenceGroup -Name "Second Group"
Add-CMTaskSequenceStep -InsertStepStartIndex 1 -TaskSequenceName $TS.Name -Step $Group2

# Create the second Run Command Line action
$Step2 = New-CMTaskSequenceStepRunCommandLine -StepName "Run Command 2" -CommandLine "cmd.exe /c"
Set-CMTaskSequenceGroup -TaskSequenceName $TS.Name -StepName $Group2.Name -AddStep $Step2 -InsertStepStartIndex 0



Yep, here it is.

The resulting task sequence.


Written by Johan Arwidmark

Deployment News

Happy deployment, and thanks for reading!

What our lawyers makes us say:

This information is provided "AS IS" with no warranties, confers no rights and is not supported by the authors or Deployment Artist.

Copyright © 2017 by Deployment Artist (the company behind deployment research). All rights reserved. No part of the information on this web site may be reproduced or posted in any form or by any means without the prior written permission of the publisher.

Shorthand: Don't pass off our work as yours, it's not nice.

Blog Archive


Where you can meet us!

Live Stream Recordings
ConfigMgr 1806 and W10 OSD

5 Days - Mega Geek Week 
(multiple classes, ConfigMgr, OSD etc.)
- Johan Arwidmark, Mikael Nystrom...
Jun 10, 2019, Chicago, IL, US

4 Days - Windows 10 OSD Classes
- Johan Arwidmark
May 20, 2019, San Diego, CA, US
Jun 17, 2019, Culemborg, NL
Jul 8, 2019, Phoenix, AZ, US

5 days - ConfigMgr Classes
- Johan Arwidmark and Kent Agerlund
Apr 8, 2019, Chicago, IL, US
Apr 22, 2019, Houston, TX, US

Video-based trainings

MDT, Windows 10 and ConfigMgr Books

Contact Info