Automatically Capture Hard Blocker

This was one of Keith S. Garner’s (@keithga1) gifts to me before he parted ways on his new adventure.  I asked him for a script to automatically pull the Hard Blocker from the compatdata XML file created during the Windows 10 compatibility scan.  After I gave him my request, he hit me up on skype about 2 hours later and said he didn’t write a script, he wrote me a 1 liner.  Keith knows how much I like 1 liners.  Why?  Task Sequences!  If I don’t have to have content to accomplish a step, all the better!  I've been known to build scripts on the fly using echo >> script.bat then running the script.bat file just so I don't have to have content.

So what’s this magic 1 line of code?  I'm getting to that.

I’ve modified it slightly, one example writes it directly to the Registry, and one that writes it to a TS Variable, and you can then do what you want with it.  I’ve added that TS Variable to be written to WMI & the Registry in my modified “SetOSDInfo” Script that I recently blogged.  I’ve updated that script as well to include this.

Registry Key:  (modify the Registry Path for your own needs)

image

OSD Variable

image

Have the  Step set to run if TS Variable _SMSTSOSUpgradeActionReturnCode = 3247440392

Here is what my registry looks like after running the CompatScan TS with both Examples.
image

From a Dump of the TS Variables (using @CCMExec’s Safe Dump)
image

At this point, you’d then collect it with your hardware inventory and add it to your reports.

5 thoughts on “Automatically Capture Hard Blocker

  • Pingback: Find Windows 10 Upgrade Blockers with PowerShell – smsagent

  • August 8, 2018 at 10:29 am
    Permalink

    Gary,
    I wanted to test new functionality but the script in the zipped file "https://garytown.com/Downloads/WaaS-PreCacheCompatScan.zip" is dated 6/5/2018.
    And I do not see anything new or related to 'Hard Blocker ' in that script.
    I am using from link for donwloads?
    Thanks,

    Reply
    • August 8, 2018 at 12:31 pm
      Permalink

      Mike,

      I don't believe Gary has updated the sequence yet but has provided you with the steps to update it yourself. After you import the task sequence go and update the SetOSDInfo.ps1 file in the WaaS_Scripts package with the information found here (https://garytown.com/collect-osd-ipu-info-with-hardware-inventory) and then add the steps listed above into your sequence.

      Hope this helps.

      Reply
      • August 9, 2018 at 11:32 am
        Permalink

        Where in the script does it pick up the registry or WMI ? I think he is saying that he has updated teh script. But i am looking and cant find anything in the script related to 'Hard Blocker'

        Reply
  • August 8, 2018 at 12:40 pm
    Permalink

    Gary,

    One thing to consider, I was looking at the SetOSDInfo.ps1 code and CS_HardBlocker is set is error code C1900208 is returned. And this would continue as you cleared each hardblocker and if additional blockers are detected. However once you have cleared all the blockers there needs to be a line in the code that clears the record on CS_HardBlocker to be NA.

    My solution was to modify the following line:

    if ($hexreturncode -eq "C1900208") {New-Variable -Name "$($AttributePrefix)CS_HardBlocker" -Value $tsenv.Value("SMSTS_HardBlocker")}

    To this:

    if ($hexreturncode -eq "C1900208")
    {
    New-Variable -Name "$($AttributePrefix)CS_HardBlocker" -Value $tsenv.Value("SMSTS_HardBlocker")
    }
    else
    {
    New-Variable -Name "$($AttributePrefix)CS_HardBlocker" -Value "NA"
    }

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

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