Salvador Dali – The persistence of memory (1931)

Have you ever needed to identify how Long a Task sequence run? wouldn’t it be great if you could measure how long a configmgr Task sequence took in order to deyploy a Windows Image?  Having that Information would be great to have stored somewhere so we could create reports based on it, and see over time if something has impacted our deployment process.

Originally, I only shared a Basic VBS + powerShell script Version. Today, I am happy to share a unique full Powershell Version, with logging, and error handeling and the flexibility to combine it with other tools such as the OSDTattooer Script.


 

Version 2.1 is out!

Get latest version now on technet

 

09/09/2015 : Updated to version 2.1
*Modified main code for better tattoo possiblities with the OSDTattooer Script.
*minor bug fixes.

06/04/2015 : Updated to version 2.0
* added new code used during the presentation at the BPUG meeting.
* Added Write to registry possiblities.


There are two ways of using this solution:

  • Old  style: VBS script to start the time recording process, and a Powershell Script to read it, and Tattoo it.
  • New Style: One unique PowershellScript to set and get the time process.

 

Setting up the task sequence :

 

Step1: Download the script, and prepare your Task Sequence:

During the first meeting of the Basel PowerShell User Group (BPUG), I have presented a full powershell version of this script that I use in order to measure the time it takes for a Task sequence to execute. I have finally found some time to upload it, and share it with you.

edit: The version 2.1 is an enhanced version that includes error handeling, logging,  better integrability with external tools such as the OSDTattooer Script and in the SMSTS.log(!)

The original mechanism really doesn’t changed  compared to the very first version I wrote in VBS (Beurk!): it creates a TS variable at the very beginning of the Configmgr Task sequence, and it reads it it out at the end of the task sequence.

If you want to Tattoo the time executed into the WMI, Registry and/or environment variables, combine it with the OSD Tattooer script. have a look at here –> OSD Tattooer script.

Follow These steps in order to measure configmgr Task sequence time using powershell:

1) Download the Manage-OSDTime script from Technet (If you liked it, please rate it !)

2)Create a package without a program containing the downloaded Manage-OSDTime.ps1 and upload it to your adequate distribution Points

3) Create the  “Start OSD Time process” at the very beggining of your Task sequence and configure it as on the Screen shot below.

3) Create the Start OSD Time Process after the HDD is partioned and formated, and configured it as the on the screen shot below.

SetOSDStartTime

The task sequence mechanism needs a place to download the package too, before he can execute it. For this reason, the Managed-OSDTime package must be set after the partioning disk part. If you don’t deploy bare metal machines (READ: if there is already a disk formated and usable) then you can set the Manage-OSDTime package as the very first step of your task sequence.

4) Create the  “End OSD Time process” at the very end of your Task sequence and configure it as on the Screen shot below.

get osdtime_end configmgr

Notice that I haven’t set it as the very last step of my configmgr Task sequence. That is simply because I Tattoo all of the Information in the next and last step using the OSD Tattooer script. Read more about it right here!

Manage-OSDTime.ps1 comes with the possibility to tattoo the information without any external artefacts. For that you can simply add the parameter “-Tattoo“. It will by default tattoo in the HKLM:SoftwareOSBuildinfo It is possible to change the key value ‘OSBuildInfo‘ by adding the parameter –Root “YourCompanyName” for example.

Nethertheless, I would recommend to use the OSD-Tattooer script, which makes complete process more easy and expandable.

2) Check the results:

The information will be expressed in minutes in the following format: MM.SS (Which stands for Minute minute, second second).

When combined with the OSD-TattooerScript, information will be present in the following three locations

a) Registry

Registry

b) WMI

WMI

c)Environment variables

OSD Tattoo Environment variables

2) Getting Manage-OSDTime script execution information

I have written this script in a way, that you can find logging information on several different places:

a) SMST.Log general log file.

The Manage-OSDTime.ps1 script will create the status logs in the SMSTS.log file. The status messages are always prexided with

[OSDTIME] so, if you search information on the Manage-OSDTime.ps1 simply go search for [OSDTIME] in the SMSTS.log log file.

smsts

b) Manage-OSDTime.Log

The second place where you can find information, is in the script log it self. By default, the log is located in the following directory –> C:SystemLogsManage-OSDTime.Log

 

OSDLog

 

That’s basically it.

I would love to hear your feedback!

If you have done it another way in your organization, be part of the fun, and drop line explaining how you have done. I am really curious about it !