Collect OSD / IPU Info with Hardware Inventory

Update 2019.01.22 To include User Account that triggered the Upgrade & Unique Build Record Info. Blog Post for "Gather Account Name during IPU" HERE

Update 2018.08.01 To include Hard  Blocker from  Compat Scan, requires you to add a step into the TS to capture the Hard  Blocker to a  TS Variable,  Blog Post HERE

Update 2018.06.05 - I've posted the first WaaS Post, which incorporates this Script into a Compatibility Scan Task Sequence.  I've updated the script since this post, which is available to download, along with the Task Sequence Export in this POST HERE

Several years ago I started to use Jason Sandys’ OSDInfo Script.  I liked the idea of having a script run during OSD that would write information to WMI, which made it easy to inventory.  Now I do IPU (In Place Upgrade) so much more than OSD, and I wanted to do the same, gather important information from IPU and be able to use it for Reporting or creating collection queries.

I’ve taken Jason’s script and modified it… a lot.  All of his plumbing is still in place (functionality to add information to WMI & Registry), but I’ve added a lot of logic around using the script for different functions.

The script is now broken into 3 sections, OSD (Operating System Deployment), CS (Compatibility Scan), IPU (In Place Upgrade).  Using TS Variables, the script will run different sections of the script.  This allows me to use the same script in numerous scenarios.
First, I’ll show you results, and then go into details about how it’s done.  But I feel it’s easier to understand the script and process if you can see the end product.Registry, Creates WaaS Key, then subkeys for OSD and IPU Build Numbers to keep thing separated for historical data.  If you’re a Reg2Mof person, this is probably the way you’ll want to go.

OSD Info:

CompatScan = Green
IPU = Yellow
Both Processes = Blue (IPU overwrites CS info)


WMI: (Makes it easy to import into Hardware Inventory, but the data is spread out a bit instead of in one nice view)
Classes: CompatScan / IPU / OSD
Instances: Build Number
Prosperities: Details from each process


SQL: (When using WMI & Hardware Inventory)


Used for Report:

Ok, now to the “How” section, the Script:  Can be downloaded along with the entire WaaS_Scripts Package Here: WaaS_Scripts Package (122 downloads)
Requires Several TS Variables to function, will cover after script.

Step in Task Sequences
Required Variables in TS:
SetOSDInfoType: Set to OSD / CS / IPU - Tells the Script which section to run.

I set the osdbuildversion variable in the beginning of the TS, which gets used in the script & command line. NOTE… I’ve changed this to SMSTS_BUILD, as I was using that in other places and make my life eaiser for consisteancy.


SMSTS_StartTSTime - Records time at the very start of the TS

SMSTS_FinishTSTime - Records time near the end of the TS, used in the script to calculate run time of TS

CheckReadinessResult: If Check Readiness Fails, Set to FAIL

SMSTS_StartUpgradeTime - Records time right before Upgrade Step Starts.

SMSTS_FinishUpgradeTime - Records time right after Upgrade Step finishes, to calculate upgrade time

SMSTS_DMDepartment - Collection Variable - Specific to my Test Lab to help track which Department a computer belongs to
SMSTS_DMLocation - Collection Variable - Specific to my Test Lab to help track which Branch computer belongs to
- These are just for sample to show you can collect information like this during IPU / OSD.  Recommend Customization them for your environment or removing them from the script.

OSD: Run Powershell Script:


CompatScan: Run PowerShell Script


IPU: Run PowerShell Script:


Add to Hardware Inventory: Set Classes –> Add –> Connect –> Computer Name of machine you ran the script on and you confirmed the WMI NameSpace and values are created –> Ensure you change the namespace to the namespace you specified in the TS-> Connect

Check the Boxes and click OK: (I’ve already done this, which is why they say “exists” in this screen capture, and the class names are greyed out, but when you do it the first time, you’ll be able to check those boxes)

You can then verify all the fields then and check the ones you want. If you change the script in the future, you’ll need to come back in here and modify what you’ve checked.


Used in Collection Queries:


And now, as machines run through your process, and hardware inventory is collected, you’ll have useful data to provide.

If you have any questions, let me know.  I've been running this so long, that I might have missed a step I needed to set it all up originally.

Published originally on

11 thoughts on “Collect OSD / IPU Info with Hardware Inventory”

  1. Gary, this looks very interesting and i am trying to test it in my IPU TS. I do have few questions...but to start where do you run the script in your TS?

  2. Thanks again...This is great and everything is working...For some reason I have TSRun time as 0. I have SMSTS_StartUpgradeTime and SMSTS_FinishUpgradeTime before and after Upgrade Operating System step. I wanted to ask if you can have a post about a report you are using in this post or maybe share an rdl file?
    Thank you.

  3. I'm having an issue with the TS Run time and It looks like it because i'm in Australia and our date time format is different to US.
    SMSTS_StartTSTime = 10/26/2018 10:47:27 AM
    SMSTS_FinishTSTime = 26/10/2018 11:11:45 AM
    Here you can see that the StartTSTime is in the US date format where at the end of the task sequence it's in the Australia date time format. Any ideas on how we could work around this issue?

    • Interesting, so at the beginning of the TS. I assume this is OSD, not IPU, the machine is running in US, then later in the process you've applied the Australian region. I'd play with formatting it. Check out: -Format FileDateTime. Just remember, if you change for format, you'll have to update each step that sets a time stamp, and update the script as well. Hope that helps. Hit me up on twitter if you run into any issues. Once you've made all the changes, I'd like to hear your results.

      • Correct it's only an issue on OSD as the WinPE we are using is en-US.
        I managed to find a way around it by using the following command instead of Get-Date for the SMSTS_StartTSTime variable.

        Also I did have issues with calculating the TSRunTime in minutes as well.
        I changed the first Difference line to the below.
        $Difference = ([datetime]::ParseExact($TSEnv.Value('SMSTS_FinishTSTime'),"dd/MM/yyyy h:mm:ss tt",$null)) - ([datetime]::ParseExact($TSEnv.Value('SMSTS_StartTSTime'),"dd/MM/yyyy h:mm:ss tt",$null))

        • Had issues still calculating the TSRunTime and I've found that this works.
          $Difference = [datetime]$TSEnv.Value('SMSTS_FinishTSTime') - [datetime]$TSEnv.Value('SMSTS_StartTSTime')
          Not sure if your line works or not as I haven't had a chance to try it again but I have just less round brackets.

          Thanks for this amazing script.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.