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 (36)

  1. Anonymous says:

    This awesome little tool was posted on the email list today. &#160; http://blogs.technet.com/deploymentguys

  2. Jonce007 says:

    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?"

    # Export the sequence data from task sequence
    $TS = Get-CMTaskSequence -Name "$UserTSchoice" | select -ExpandProperty Sequence

    # Enter destination directory
    [string]$DestLoc = Read-Host "`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: "
    Write-Host -ForegroundColor cyan "$DestLoc"

    # Create file from export
    Write-Output '' | Out-File "$DestLoc$UserTSchoice.xml"
    Write-Output $TS | Out-File "$DestLoc$UserTSchoice.xml" -Append
    # Copy tsDocumentorv2.xsl to $DestLoc (destination location)
    Push-Location $DestLoc
    Copy-Item $SourceLoc . -Force
    Pop-Location

    # Get an object of IE application and launch the xml file
    $IE = New-Object -ComObject InternetExplorer.Application
    # navigate to the URL using Navigate method exposed by Internet Explorer object model
    $IE.Navigate("$DestLoc$UserTSchoice.xml")

    Write-Host "`nYour new file is located: "
    write-host -ForegroundColor Cyan "$DestLoc$UserTSchoice.xml`n"

    # Revert to starting directory
    Pop-Location

  3. DeploymentGuys says:

    Fred,

    You may want to check out the Desktop Deployment Planning Service resources at

    https://iwsolve.partners.extranet.microsoft.com/ddps/Resources.aspx and/or try to find a DDPS certified partner in your area.

    Good Luck,

    Aly

  4. DeploymentGuys says:

    Thanks Sam!

    – Aly

  5. Anonymous says:

    Dumb question…  We are using the exported TS, to edit and put stuff in the second line.

    Once we do add in the stuff in the second line, can that exported TS XML file STILL be used to import with, or, does the second line have to be removed?

    Thanks!

  6. Anonymous says:

    Great tool, but my TS order is after using confuse! Someone have an idea? Thanks Markus

  7. Daniel Paessens says:

    Using the steps describe on this webpage works fine with MDT 2012

  8. Jonce007 says:

    Thanks for creating a great tool. The only issue I am having is the order of steps and nested groups for SCCM2012. For example:

    Task Sequence:
    A-Group
    1-Step
    2-Step
    B-Group
    B1-Step
    B2-Step
    C-Group
    C1-Step
    3-Step
    4-Step
    D-Group
    D1-Step
    D2-Step
    5-Step
    E-Group
    6-Step

    Report shows this order:
    A-Group
    1-Step
    2-Step
    3-Step
    4-Step
    5-Step
    B-Group
    B1-Step
    B2-Step
    C-Group
    C1-Step
    D-Group
    D1-Step
    D2-Step
    E-Group
    6-Step

    Anyone else see this order issue? I checked v1 and v2 xsl files, both the same results. If someone has a fix, it would be greatly appreciated.

    ######################
    INFO:
    Regardless of the order issue, I've managed to customize the xsl a little bit for our environment. We wanted to show all steps, whether they were active or disabled.

    I took this line:

    Modified it to this:

    …and added this line after "Output Name of Step" to show if the step is disabled

    To add borders:
    Changed this border value from:


    Modified it to this:
  9. Trev Scott says:

    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.

  10. fred says:

    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

  11. fred says:

    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.

  12. Carl Walker says:

    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

  13. sam says:

    Great tool.  One question, though.  Is there a way to have a better visual separation between each task?  It all sort of runs together the way it is.  Even just a line between each one or alternating background colors.

  14. sam says:

    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.

  15. Chris says:

    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.

  16. Jay P says:

    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?

  17. Steve says:

    This tool looks great – I have used since v1.  I still don’t seem to be able to see custom variables though, e.g. WMI conditions/IF statements etc.  

    I have moved the steps to be only 1 layer down but still do not see the WMI conditions?

    example of condition (on either a group or a command line step):

    Select * FROM Win32_PnPEntity WHERE PNPDeviceID like"%10DF%"

  18. Pat Wilson says:

    I love this program, will you be making a version compatible with IE 9?

  19. Craig says:

    This doesn't work for me at all. Still just comes up as text, no formatting.

  20. Craig says:

    This doesn't work for me at all. Still just comes up as text, no formatting.

  21. Sean says:

    Has anyone seen a stylesheet for unattend.xml?

  22. Benjamin McConnell says:

    For SCCM 2012 Task Sequences you can use this same tool. Just do the following

    1. Export ConfigMgr 2012 Task Sequence to .zip file

    2. Extract .zip file

    3.Browse to SMS_TaskSequencePackagepackageid

    4.Copy tsDocumentorv2.xls to this directory

    5. open object.xml from SMS_TaskSequencePackagepackageid and search for "cdata"

    6. copy everything between <![CDATA[ and ]]>

    7. paste it into a new text file.

    8. add <?xml-stylesheet type="text/xsl" href="tsDocumentorv2.xsl"?> to the top line

    9. Save with a .xml file extension into SMS_TaskSequencePackagepackageid directory

    10. Open in IE (if using IE 9 or 10, be sure to use compatibility mode.

    This is what worked for me. I haven't really verified all the ts steps yet. But it looks likes everything is there.

  23. Ville says:

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

  24. bill says:

    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.

  25. Scott says:

    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

  26. Chrispy says:

    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

  27. Paul Storey says:

    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 🙂

  28. chobeaux says:

    @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.

  29. oscar says:

    It doesnt works for me on SCCM 2012 R2 🙁 I modified the file but when I tried to open on Internet Explorer it hangs…

  30. 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.

  31. Anonymous says:

    Pingback from Document a Configuration Manager 2012 Task Sequence | What have I learnt today?

  32. Anonymous says:

    Pingback from Document a Configuration Manager 2012 Task Sequence | What have I learnt today?

  33. Adam J. says:

    Thanks for creating a great tool. The only issue I am having is the order of steps and nested groups for SCCM2012. For example:

    Task Sequence:
    A-Group
    1-Step
    2-Step
    B-Group
    B1-Step
    B2-Step
    C-Group
    C1-Step
    3-Step
    4-Step
    D-Group
    D1-Step
    D2-Step
    5-Step
    E-Group
    6-Step

    Report shows this order:
    A-Group
    1-Step
    2-Step
    3-Step
    4-Step
    5-Step
    B-Group
    B1-Step
    B2-Step
    C-Group
    C1-Step
    D-Group
    D1-Step
    D2-Step
    E-Group
    6-Step

    Anyone else see this order issue? I checked v1 and v2 xsl files, both the same results. If someone has a fix, it would be greatly appreciated.

    ######################
    INFO:
    Regardless of the order issue, I've managed to customize the xsl a little bit for our environment. We wanted to show all steps, whether they were active or disabled.

    I took this line:

    Modified it to this:

    …and added this line after "Output Name of Step" to show if the step is disabled

    To add borders:
    Changed this border value from:


    Modified it to this:

  34. Adam J. says:

    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?"

    # Export the sequence data from task sequence
    $TS = Get-CMTaskSequence -Name "$UserTSchoice" | select -ExpandProperty Sequence

    # Enter destination directory. Create directory if not exist.
    [string]$DestLoc = Read-Host "`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: "
    Write-Host -ForegroundColor cyan "$DestLoc"

    # Create file from export
    Write-Output '' | Out-File "$DestLoc$UserTSchoice.xml"
    Write-Output $TS | Out-File "$DestLoc$UserTSchoice.xml" -Append
    # Copy tsDocumentorv2.xsl to $DestLoc (destination location)
    Push-Location $DestLoc
    Copy-Item $SourceLoc . -Force
    Pop-Location

    # Get an object of IE application and launch the xml file
    $IE = New-Object -ComObject InternetExplorer.Application
    # navigate to the URL using Navigate method exposed by Internet Explorer object model
    $IE.Navigate("$DestLoc$UserTSchoice.xml")

    Write-Host "`nYour new file is located: "
    write-host -ForegroundColor Cyan "$DestLoc$UserTSchoice.xml`n"

    # Revert to starting directory
    Pop-Location

  35. Topsporter says:

    Thanks, works perfectly with ConfigMgr 2007 R3

  36. BuffaloBro says:

    This worked perfectly. Manager wanted to look at existing TS for planning purposes re: Azure build out.