Documenting your Task Sequences Automagically (Update - v2)

A big thank you to those of you that tested the original XSL for the TaskSequence documentor and provided feedback.

This is v2 and includes some bug fixes:
    - Formats orphan steps with no Group
    - Added recursive template for Nested conditions for both groups and steps (tested to 3 levels)
    - Properly convert Not to Nor for conditions

For those of you that haven't used it - here is a re-post of the instructions:

1. Copy the attached file at the bottom of the post to the same folder as your task sequence.

2. Open your task sequence in your favourite text editor.

3. After the first line which should look something like this:

<?xml version="1.0"?> or <?xml version="1.0" encoding="utf-8"?>

enter the following as the second line:

<?xml-stylesheet type="text/xsl" href="tsDocumentorv2.xsl" mce_href="tsDocumentorv2.xsl"?>

4. Save your task sequence file and open it in Internet Explorer. Presto! The XSL takes care of formatting, indents and sizing.

Disclaimer: The information on this site is provided "AS IS" with no warranties, confers no rights, and is not supported by the authors or Microsoft Corporation. Use of included script samples are subject to the terms specified in the Terms of Use .

This post was contributed by Aly Shivji a consultant with Microsoft Services - U.S. East Region.

tsDocumentorv2.xsl

Comments

  • Anonymous
    January 01, 2003
    This awesome little tool was posted on the email list today. &#160; http://blogs.technet.com/deploymentguys

  • Anonymous
    January 01, 2003
    SCRIPT:
    Thanks to ^Chrispy^ for the export idea, I put a simple powershell script together for automating this process for SCCM2012. You will need to change the $SiteCode and $SourceLoc variables.


    # Enter SCCM site code. For example: $SiteCode = "ABC"
    $SiteCode = ""

    # Import CM module - Commented out. Remove the # if you need to enable this.
    #import-module "C:Program Files (x86)Microsoft Configuration ManagerAdminConsolebinconfigurationmanager.psd1"

    # Changes location to GMI Configuration Manager PSProvider
    Push-Location $SiteCode":"
    # Clear screen
    clear

    # Location of xsl file for converting task sequences
    [string]$SourceLoc = "\tsDocumentorv2.xsl"

    # Get all task sequences in CM12
    if ($AllTaskSequences -eq $null) {
    Write-Host -ForegroundColor Yellow "Getting Task Sequence list...may take 60 seconds"
    $AllTaskSequences = Get-CMTaskSequence -Name "*" | Sort Name
    $TSNames = $AllTaskSequences.Name | sort Name
    }
    # Display Task Sequences
    $TSNames | Sort Name

    # User input for task sequence
    $UserTSchoice = Read-host "nEnter the name of the task sequence?&quot;<br><br># Export the sequence data from task sequence<br>$TS = Get-CMTaskSequence -Name &quot;$UserTSchoice&quot; | select -ExpandProperty Sequence<br><br># Enter destination directory<br>[string]$DestLoc = Read-Host &quot;nEnter the destination directory for task sequence export"
    # Set location for TS export directory
    If (Test-Path -Path $DestLoc) {
    } ELSE {
    New-Item -Path $DestLoc -ItemType directory | Out-Null
    }
    Write-Host -NoNewline "nDestination location is set to: &quot;<br>Write-Host -ForegroundColor cyan &quot;$DestLoc&quot;<br><br># Create file from export<br>Write-Output &#39;&#39; | Out-File &quot;$DestLoc$UserTSchoice.xml&quot;<br>Write-Output $TS | Out-File &quot;$DestLoc$UserTSchoice.xml&quot; -Append<br># Copy tsDocumentorv2.xsl to $DestLoc (destination location)<br>Push-Location $DestLoc<br>Copy-Item $SourceLoc . -Force <br>Pop-Location<br><br># Get an object of IE application and launch the xml file<br>$IE = New-Object -ComObject InternetExplorer.Application<br># navigate to the URL using Navigate method exposed by Internet Explorer object model<br>$IE.Navigate(&quot;$DestLoc$UserTSchoice.xml&quot;)<br><br>Write-Host &quot;nYour new file is located: "
    write-host -ForegroundColor Cyan "$DestLoc$UserTSchoice.xml`n"

    # Revert to starting directory
    Pop-Location

  • Anonymous
    January 01, 2003
    Fred, You may want to check out the Desktop Deployment Planning Service resources athttps://iwsolve.partners.extranet.microsoft.com/ddps/Resources.aspx and/or try to find a DDPS certified partner in your area. Good Luck, Aly

  • Anonymous
    January 01, 2003
    Thanks Sam!

  • Aly
  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    Great tool, but my TS order is after using confuse! Someone have an idea? Thanks Markus

  • Anonymous
    January 01, 2003
    Using the steps describe on this webpage works fine with MDT 2012

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    February 23, 2009
    Works a treat, only snag was my own fault.. copied text of xsl and created the file rather than saving the xsl from the link.

  • Anonymous
    February 26, 2009
    Sorry I can't find a better place to ask this.  As someone who has been deploying images for 8 years using sysprep, Bart Boot CD and Ghost, I can really appreciate what you do.  I have a single image that covers 700 dekstop and laptop models which is great.  I would really like to take my processes to the next step with PXE Boot, ImageX, etc.  Problem is, I just have too many questions and I find a lot of the documentation to be difficult to follow.  I'm stuck in Windows XP by corporate declaration so, I have to reach around to understand any differences between the Vista oriented docs.  Anyway, without getting any deeper, I'm really looking to have this question answered: Is there any official training out there?  I have not seen such a thing.  I think I benefit most from classroom training and a lot of the subjects you cover assume I have a grasp on the basics of BDD (obviously I don't). Thanks and sorry if this is the wrong place to ask such a question.. you're definitely the right guys

  • Anonymous
    February 28, 2009
    Thanks Aly, Never considered that there are consultants who could give me the knowledge, experience I crave.  We'll see what I can find and if I can convince my company to pay for such a thing.

  • Anonymous
    March 01, 2009
    Fred, I'd be glad to help with email or a phone conversation. There are some fundamentals with MDT and ConfigMgr OSD but once you have them the rest becomes common sense. As you have deployed builds before I reckon once you've had the opportunity to bounce your questions off someone you'll  be away, and this really is a great way to deploy your builds. Cheers, Carl carl262 at hotmail dot com

  • Anonymous
    March 09, 2009
    The comment has been removed

  • Anonymous
    March 17, 2009
    I dug a bit into how to do xsl formatting and found the answer to my question so figured I'd share it. First, you need to set up the colors for the alternating rows.  To do this, replace the TD.step background color in the STYLE section with a TD.step_0 and TD.step_1.  Set them to the two colors that you want (I used FFF7E2 and FFF1BF which look OK). Then go through the rest of the document and look for lines that say "Class = "step"" and replace them with "Class="step_{position()  mod 2}" The code "position() mod 2" will return 0 for even lines, and 1 for odd lines, and use the background color step_0 or step_1 alternately. It's much easier to read that way.

  • Anonymous
    June 23, 2009
    This is an awesome tool. To address Sam's quest a little further. I took each output and paste it into Excel. Then you can manipulate it however you want. In my case with SCCM I use 3 different tasks to get to a final product so this allowed me to put the whole process in excel so I have a final document to turn in. Chris S.

  • Anonymous
    February 10, 2010
    Great tool!!  Thank you!  Just curious since most of the SCCM data is in SQL, are there tools out there to capture settings for documentation?

  • Anonymous
    March 31, 2010
    The comment has been removed

  • Anonymous
    April 29, 2011
    I love this program, will you be making a version compatible with IE 9?

  • Anonymous
    July 04, 2011
    This doesn't work for me at all. Still just comes up as text, no formatting.

  • Anonymous
    July 04, 2011
    This doesn't work for me at all. Still just comes up as text, no formatting.

  • Anonymous
    November 28, 2011
    Has anyone seen a stylesheet for unattend.xml?

  • Anonymous
    November 21, 2012
    The comment has been removed

  • Anonymous
    December 04, 2012
    Any similar tool for ConfigMgr 2012? It has completely different format, and I believe this kind of approach does not work.

  • Anonymous
    February 11, 2013
    I'm having issues with this working for SCCM 2012. I've exported the task sequence but am not sure what xml file to edit as there are alot of them.

  • Anonymous
    February 27, 2013
    Didnt work for me with IE9, but works fine if I open it in Excel and then select the Style Sheet. Thanks this is awesome

  • Anonymous
    August 29, 2013
    I think I may have found an easier (and quicker) way to create the XML file.

  1. Load the SCCM PowerShell module
  2. Connect to your site
  3. $TS = Get-CMTaskSequence -Name "<Your Task Sequence Name" | select -ExpandProperty Sequence
  4. Write-Output '<?xml-stylesheet type="text/xsl" href="tsDocumentorv2.xsl"?>' | Out-File "C:tempTaskSequence.xml"
  5. Write-Output $TS | Out-File "C:tempTaskSequence.xml" -Append
  6. Ensure you have a copy of the stylesheet in the same directory as your xml file
  7. Open the xml file in Internet Explorer
  • Anonymous
    October 17, 2013
    Brilliant! Just decided to see if there were tools around for documenting my MDT installation and this was the first I stumbled on. Just what I needed for the Task Sequences. Thanks :-)

  • Anonymous
    December 02, 2013
    @Chrispy thanks a lot for your method, it worked very well! and yes it's far quicker to export the TS this way instead of going through the wizard. I'm running sccm 2012 R2, on a remote console I just had to use the "connect via Windows PowerShell" button and type the power shell commands.

  • Anonymous
    February 20, 2014
    It doesnt works for me on SCCM 2012 R2 :( I modified the file but when I tried to open on Internet Explorer it hangs...

  • Anonymous
    April 14, 2014
    I've tried both methods for my sccm 2012 sp1 setup - powershell and export/modify, and even tried excel 2010. sometimes i get absolutely nothing at all when i open the resulting xml in ie9, and sometimes i just get a big wall of unformatted black & white text. i want this to work so badly, as right now i am sort of laying things out in visio to show what modules get installed in what order, but if i could get this working, it'd save me a ton of time and let me remove visio from my system to boot.

    i added to the beginning and a matching at the end of the xml generated from powershell and tried opening it in excel. this at least asked me if i wanted to use the stylesheet, which i said yes, and it looks similar to the stuff shown in this article, but still a bit unweildy and hard to look at - it lists way too much info. may try tweaking the xsl or main xml to exclude stuff i don't want, and see if that works.

  • Anonymous
    May 20, 2014
    Pingback from Document a Configuration Manager 2012 Task Sequence | What have I learnt today?

  • Anonymous
    May 20, 2014
    Pingback from Document a Configuration Manager 2012 Task Sequence | What have I learnt today?

  • Anonymous
    July 10, 2014
    The comment has been removed

  • Anonymous
    July 10, 2014
    SCRIPT:
    Thanks to ^Chrispy^ for the export idea, I put a simple powershell script together for automating this process for SCCM2012. You will need to change the $SiteCode and $SourceLoc variables. Remember to copy the tsDocumenorv2.xsl out to the network location.


    # Enter SCCM site code. For example: $SiteCode = "ABC"
    $SiteCode = ""

    # Import CM module - Commented out. Remove the # if you need to enable this.
    #import-module "C:Program Files (x86)Microsoft Configuration ManagerAdminConsolebinconfigurationmanager.psd1"

    # Changes location to GMI Configuration Manager PSProvider
    Push-Location $SiteCode":"
    # Clear screen
    clear

    # Location of xsl file for converting task sequences
    [string]$SourceLoc = "\tsDocumentorv2.xsl"

    # Get all task sequences in CM12
    if ($AllTaskSequences -eq $null) {
    Write-Host -ForegroundColor Yellow "Getting Task Sequence list...may take 60 seconds"
    $AllTaskSequences = Get-CMTaskSequence -Name "*" | Sort Name
    $TSNames = $AllTaskSequences.Name | sort Name
    }
    # Display Task Sequences
    $TSNames | Sort Name

    # User input for task sequence
    $UserTSchoice = Read-host "nEnter the name of the task sequence?&quot;<br><br># Export the sequence data from task sequence<br>$TS = Get-CMTaskSequence -Name &quot;$UserTSchoice&quot; | select -ExpandProperty Sequence<br><br># Enter destination directory. Create directory if not exist.<br>[string]$DestLoc = Read-Host &quot;nEnter the destination directory for task sequence export"
    # Set location for TS export directory
    If (Test-Path -Path $DestLoc) {
    } ELSE {
    New-Item -Path $DestLoc -ItemType directory | Out-Null
    }
    Write-Host -NoNewline "nDestination location is set to: &quot;<br>Write-Host -ForegroundColor cyan &quot;$DestLoc&quot;<br><br># Create file from export<br>Write-Output &#39;&#39; | Out-File &quot;$DestLoc$UserTSchoice.xml&quot;<br>Write-Output $TS | Out-File &quot;$DestLoc$UserTSchoice.xml&quot; -Append<br># Copy tsDocumentorv2.xsl to $DestLoc (destination location)<br>Push-Location $DestLoc<br>Copy-Item $SourceLoc . -Force <br>Pop-Location<br><br># Get an object of IE application and launch the xml file<br>$IE = New-Object -ComObject InternetExplorer.Application<br># navigate to the URL using Navigate method exposed by Internet Explorer object model<br>$IE.Navigate(&quot;$DestLoc$UserTSchoice.xml&quot;)<br><br>Write-Host &quot;nYour new file is located: "
    write-host -ForegroundColor Cyan "$DestLoc$UserTSchoice.xml`n"

    # Revert to starting directory
    Pop-Location

  • Anonymous
    July 29, 2014
    Thanks, works perfectly with ConfigMgr 2007 R3

  • Anonymous
    August 06, 2015
    This worked perfectly. Manager wanted to look at existing TS for planning purposes re: Azure build out.