How to send SetupDiag Result in your SCCM Inventory during a Windows 10 Feature Update

Jonathan LefebvreSCCM, WINDOWS 106 Comments

5
(3)

Windows 10 Feature updates can be tricky for many reasons. Fellow SC Dudes, Adam Gross, created a free and easy-to-implement solution to help debug and track down Feature Update logs.

This solution will describe how to send SetupDiag Result in your SCCM Inventory during a Windows 10 Feature Update. Along with our previous post to track down Windows 10 Feature Update hard blocks, will greatly ease Windows 10 Servicing.

Windows 10 SetupDiag SCCM Inventory Benefits

  • Centralized log for any on-prem Feature Update attempt
  • SetupDiag details stored in Hardware Inventory, which can be monitored by SQL query/reports and PowerBI

While we recommend sticking to Feature Update to deliver new Windows 10 builds, this solution will work the exact same if a Task Sequence is used to do an upgrade.

In this post, we’ll detail how to implement the Windows 10 Feature Update script to include it in your SCCM Inventory. This should help you with Feature update failures by identifying errors easily.

Requirements

We will now prepare our environment by downloading the script from Github and store it locally.

Important Info

Microsoft has recently announced that SetupDiag will now be included in Windows 10 2004 and up.

While this is good news, the current setup provided here can remain valid or could be modified to match this.

MEMCM 2010 was just released and some analysis from SetupDiag is now included. Again, this requires Windows 10 2004 or higher to work. See Microsoft docs for more details.

Windows 10 SetupDiag SCCM Inventory
  • Extract the content of the ZIP to a short path, like C:\temp\ for example
Windows 10 SetupDiag SCCM Inventory

Configure the script for your environment

Now that the script is downloaded, we must edit it to include our server information :

  • Edit SetupFUFramework.ps1 and modify the following section
    • Set the following variables to match your environment
    • $SiteCode
    • $SiteServer
    • $ApplicationFolderName
    • $ApplicationSourceRoot
    • $NetworkLogPath
      • This will be used to centrally store logs following a feature update.
      • This needs to be a simple share that domain-joined devices can write to it.
  • Optional. Modify those value, has those will define the ConfigMgr Application, and local path used by the various scripts.
  • Add SetupDiag.exe to the Content/Scripts path.
Windows 10 SetupDiag SCCM Inventory
  • Optional – All this can be done at the command line to launch the script
.\SetupFUFramework -SiteCode "PS1" -SiteServer "CM01.ASD.NET" -ApplicationFolderName "FUApplication" -ApplicationSourceRoot "\\CM01.ASD.NET\Media\$($ApplicationFolderName)" -NetworkLogPath "\\CM01.ASD.NET\FeatureUpdateLogs"

Execute the SetupFUFramework script

All the magic resides in Adam’s script. We will now run the script to create the application and CI on your SCCM Server. Everything will be done automatically:

  • Open a PowerShell command windows as a MEMCM admin
  • Navigate to the script location and run it :
Windows 10 SetupDiag SCCM Inventory
  • The script will create the following:
    • An application named Feature Update – Client Content
  • A set of Configuration Items under a Feature update folder
  • A set of Configuration Baselines under a Feature Updates folder

Modify the Feature Update – SetupDiag version CI

  • Edit the Feature Update – SetupDiag Version configuration baseline item. Select Properties
  • Under Compliance select New
Windows 10 SetupDiag SCCM Inventory
  • Select Feature Update – SetupDiag Version
  • Set the following:
    • Rule Type: Value
    • Property: File Version
    • the value must match the version of SetupDiag downloaded
    • Set Noncompliance to critical
Windows 10 SetupDiag SCCM Inventory

Modify Hardware Inventory

For added value, the hardware inventory must be modified with 2 Custom MOF to be imported. This will allows showing the SetupDiag results in your SCCM Compliance or hardware inventory reports.

  • Go to Administration/Clients settings, and edit the Default Client settings.
  • Under Hardware Inventory, select Set Classes
Windows 10 SetupDiag SCCM Inventory
  • Select Import
Windows 10 SetupDiag SCCM Inventory
  • Select one of the 2 MOF to be imported. They are in the extracted folder\MOF
  • Once imported, repeat steps for the second MOF file.
Windows 10 SetupDiag SCCM Inventory
  • Once done, they can be check/unchecked if you prefer to test it in custom Client settings prior to rollout to production

Deployments

Once all this is in place, the following components must be deployed on your clients:

  • Feature Update – Client Content application, to stage SetupDiag
  • Configuration Baselines, to report back compliance
    • This could then become hard requirements before initiating a Feature Update
  • Client settings for the hardware inventory

Results

With everything in place, Feature Update can be initiated. Once ran, the following should be available.

  • Under the resource explorer of a device, the details from the Feature update is available. Reminder, this is based of the Hardware inventory cycle!
Windows 10 SetupDiag SCCM Inventory
  • Logs were copied to a central share .
”Watch
  • You can also run the included PowerBI report to see the results
Windows 10 SetupDiag SCCM Inventory
Windows 10 SetupDiag SCCM Inventory

Additional notes

The SetupConfig.ini is key for Windows 10 Feature Update. it drives multiple behaviors. Adam wrote a great post about this. It can be edited under the Configuration item, Feature Update – SetupConfig.ini.

We hope this Windows 10 SetupDiag SCCM Inventory post was helpful ! Let us know in the comment section if you’re using it.

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 3

No votes so far! Be the first to rate this post.

6 Comments on “How to send SetupDiag Result in your SCCM Inventory during a Windows 10 Feature Update”

  1. Hi Jonathan

    I have tried to shorten the path no luck yes the account i have used is local admin (also the script is run as admin) and the account used is also config admin.

    The application is created (afterwards the script failed) but no deployment type it seems that something went wrong with $SetupDiagDetectionClause
    $SetupDiagDetectionClause = @{
    FileName = “SetupDiag.exe”
    Path = (Join-Path -Path $FUTempPath -ChildPath “Scripts”).ToString()
    PropertyType = [Microsoft.ConfigurationManagement.DesiredConfigurationManagement.FileFolderProperty]::Version
    ExpressionOperator = [Microsoft.ConfigurationManagement.Cmdlets.Dcm.Commands.RuleExpressionOperator]::GreaterEquals
    ExpectedValue = $SetupDiagVersion
    Value = $true
    Is64Bit = $true

    But I cannot figure it out what exactly , maybe you have some clue
    Did you use the newest Endpoint Configuration Manager version 2010

    Regards

    JJ

      1. Hi Jonathan

        I have done the following
        I had a test lab also with version 2006
        When I tested it on that environment everything went smoothly
        Creating Application Content in C:\Windows\temp\test\FUApplication
        + Generating failure.cmd √
        + Generating SetupComplete.cmd √
        + Generating precommit.cmd √
        + Generating preinstall.cmd √
        + Generating postuninstall.cmd √
        + Generating success.cmd √
        + Creating file from C:\Windows\temp\test\Templates\Process-FeatureUpdateLogs.ps1 template √
        + Creating file from C:\Windows\temp\test\Templates\Process-SetupDiag.ps1 template √
        + Copying files to C:\Windows\temp\test\FUApplication √
        + Copying files to \\sccm2002\source\test\FUApplication √
        Content created! √
        Creating Feature Update Configuration Items and Baselines
        ########################################################
        + Connecting to CMProvider.. √
        + Creating new Application Feature Update – Client Content. √
        + Creating Feature Update – SetupConfig.ini Configuration Item.. √
        + Creating Feature Update – OS Version Inventory Configuration Item.. √
        + Creating Feature Update – SetupDiag Inventory Configuration Item.. √
        + Creating Feature Update – SetupDiag Version Configuration Item.. √

        Afterwards I deleted the application and upgraded that environment to version 2010
        I run again the setup SetupFUFramework.ps1 and received the same error
        Creating Application Content in C:\Windows\Temp\test\FUApplication
        + Generating failure.cmd √
        + Generating SetupComplete.cmd √
        + Generating precommit.cmd √
        + Generating preinstall.cmd √
        + Generating postuninstall.cmd √
        + Generating success.cmd √
        + Creating file from C:\Windows\Temp\test\Templates\Process-FeatureUpdateLogs.ps1 template √
        + Creating file from C:\Windows\Temp\test\Templates\Process-SetupDiag.ps1 template √
        + Copying files to C:\Windows\Temp\test\FUApplication √
        + Copying files to \\sccm2002\source\test\FUApplication √
        Content created! √
        Creating Feature Update Configuration Items and Baselines
        ########################################################
        + Connecting to CMProvider.. √
        + Creating new Application Feature Update – Client Content. X
        ########################################################
        The following error occurred:
        + Cannot bind parameter ‘ExpressionOperator’. Cannot convert value “GreaterEquals” to type “Microsoft.ConfigurationMana
        gement.Cmdlets.Dcm.Commands.FileFolderRuleExpressionOperator” due to enumeration values that are not valid. Specify one
        of the following enumeration values and try again. The possible enumeration values are “IsEquals,NotEquals,GreaterThan,L
        essThan,Between,GreaterEquals,LessEquals,OneOf,NoneOf”.
        + Line: 365

        I think something has changed in version 2010 , but i cannot find what caused the error in version 2010 , probable something to do with the $SetupDiagDetectionClause in the script
        Hopefully we can get this working with version 2010

        Regards

        JJ

  2. Hi Jonathan

    We want to test the above, we want to try using servicing instead of the upgrade tasksequences we use now.
    The above seems promising so we want to implement this inventory but we stumble on an issue when running the script SetupFUFramework.ps1.
    Our test environment is SCCM version 2010
    When we run the script we receive the following output / error
    Creating Application Content in C:\temp\Windows10FeatureUpdates\FUApplication
    + Generating failure.cmd √
    + Generating SetupComplete.cmd √
    + Generating precommit.cmd √
    + Generating preinstall.cmd √
    + Generating postuninstall.cmd √
    + Generating success.cmd √
    + Creating file from C:\temp\Windows10FeatureUpdates\Templates\Process-FeatureUpdateLogs.ps1 template √
    + Creating file from C:\temp\Windows10FeatureUpdates\Templates\Process-SetupDiag.ps1 template √
    + Copying files to C:\temp\Windows10FeatureUpdates\FUApplication √
    + Copying files to \\sccm2020\Media2\FUApplication √
    Content created! √
    Creating Feature Update Configuration Items and Baselines
    ########################################################
    + Connecting to CMProvider.. √
    + Creating new Application Feature Update – Client Content. X
    ########################################################
    The following error occurred:
    + Cannot bind parameter ‘ExpressionOperator’. Cannot convert value “GreaterEquals” to type “Microsoft.ConfigurationManagement.Cmdlets.Dcm.C
    meration values that are not valid. Specify one of the following enumeration values and try again. The possible enumeration values are “IsEq
    quals,LessEquals,OneOf,NoneOf”.
    + Line: 356
    ########################################################
    New-CMDetectionClauseFile : Cannot bind parameter ‘ExpressionOperator’. Cannot convert value “GreaterEquals” to type
    “Microsoft.ConfigurationManagement.Cmdlets.Dcm.Commands.FileFolderRuleExpressionOperator” due to enumeration values that are not valid. Spec
    try again. The possible enumeration values are “IsEquals,NotEquals,GreaterThan,LessThan,Between,GreaterEquals,LessEquals,OneOf,NoneOf”.
    At C:\temp\Windows10FeatureUpdates\SetupFUFramework.ps1:356 char:39
    + $cla3 = New-CMDetectionClauseFile @SetupDiagDetectionClause
    + ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [New-CMDetectionClauseFile], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.ConfigurationManagement.Cmdlets.Dcm.Commands.NewDetectionClauseFile

    Hopefully you can point me to the right direction to get this working
    Thanks in advance
    JJ

    1. Hi JJ,

      from that, I would assume the Client FEature update application isn’t created right?

      You can try to shorten the path of execution for the PS1. like C:\TEmp\WFU\
      And did you run the script as local admin and ConfigMgr admin?
      Jonathan

Leave a Reply