How can I use PowerShell to populate Windows 10 CB, CBB, LTSB and Insider Preview collections in System Center Configuration Manager (Current Branch)

Introduction

In a previous post I showed you how you could create a bunch of collections (for OSD and Software Update Management) that could be used for Windows 10 servicing. I’ve updated the script to add queries and exclude rules for the four Software Update Management collections.

updated script

Update: I’ve updated the script (updated 2016/8/16) with queries to include Windows 10 (version 1607) and Windows 10

query and exclusion

This will allow those collections to populate with the correct devices automatically.

populated

You can run this script even if you previously created the collections as it will not re-create them if found. The four collections used for Windows 10 servicing and software update management are as follows:

  • SUM Windows 10 CB
  • SUM Windows 10 CBB
  • SUM Windows 10 LTSB
  • SUM Windows 10 Other

To define if a computer is Current Branch or Current Branch for Business, you can specify the group policy setting, Defer Upgrades and Updates. 

defer upgrades and Updates

The GPO setting is found in Computer Configuration, Administrative Templates, Windows Components, Windows Update of the 1511 ADMX templates which you can import into Active Directory as described here. If the GPO is enabled then all appropriate Windows 10 computers targeted with it will become Current Branch for Business.

The client properties (within ConfigMgr) for Operating System Readiness Branch of this Windows 10 device below reveal that it is running Windows 10 Current Branch for Business.

defer upgrades

If the GPO is not set, then Windows 10 will be shown as Current Branch with an Operating System Readiness Branch defined as Do not defer upgrades as below.

do not defer upgrades

If you are deploy Windows 10 using Windows 10 LTSB media then the Operating System Readiness Branch will be defined as LTSB as shown below.

ltsb

If you are using Windows Insider Preview releases then they can show up as if they were Current Branch or Current Branch for Business depending on the setting, therefore we exclude them from that collection. Also to note, Windows 8.1 devices will show up in your Current Branch collection if you only search for the Operating System Readiness Branch, therefore the queries also look for the Operating System name and version. This is most likely a bug.

w10insider

Running the Script

On the ConfigMgr server, start Windows PowerShell ISE as administrator and load the script. Adjust any variables to suit your needs prior to executing it. To run the script click on the green triangle. Sample output is shown below (you can run it over and over again).

running the script

The collections will now auto populate with your respective Windows 10 devices

collections populated

Show me the queries

The queries are based  on the Operating System Readiness Branch device property. This device property is picked up via the Heartbeat discovery method. The queries used to populate the collections are shown below for your reference:

  • SUM Windows 10 CB

select SMS_R_System.ResourceId, SMS_R_System.ResourceType, SMS_R_System.Name, SMS_R_System.SMSUniqueIdentifier, SMS_R_System.ResourceDomainORWorkgroup, SMS_R_System.Client from  SMS_R_System where SMS_R_System.OSBranch = 0 and (SMS_R_System.OperatingSystemNameandVersion = “Microsoft Windows NT Workstation 10.0” or SMS_R_System.OperatingSystemNameandVersion = “Microsoft Windows NT Workstation 10.0 (Tablet Edition)”)

  • SUM Windows 10 CBB

select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_R_System.OSBranch = 1 and (SMS_R_System.OperatingSystemNameandVersion = “Microsoft Windows NT Workstation 10.0” or SMS_R_System.OperatingSystemNameandVersion = “Microsoft Windows NT Workstation 10.0 (Tablet Edition)”)

  • SUM Windows 10 LTSB

select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_R_System.OSBranch = 2 and (SMS_R_System.OperatingSystemNameandVersion = “Microsoft Windows NT Workstation 10.0” or SMS_R_System.OperatingSystemNameandVersion = “Microsoft Windows NT Workstation 10.0 (Tablet Edition)”)

  • SUM Windows 10 Other

select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceID = SMS_R_System.ResourceId where (SMS_R_System.OperatingSystemNameandVersion = “Microsoft Windows NT Workstation 10.0” or SMS_R_System.OperatingSystemNameandVersion = “Microsoft Windows NT Workstation 10.0 (Tablet Edition)”) and SMS_G_System_OPERATING_SYSTEM.BuildNumber not in (“10586″,”10240″,”14393”)

Note: The query used for SUM Windows 10 Other will show all Windows 10 releases releases that are neither Windows 10 version 1507 (build 10240) or Windows 10 version 1511 (build 10586). Once Windows 10 Redstone ships, you’ll want to update the script to include whatever build number it is.

Downloads

You can download the PowerShell script used to create the collections and populate the queries here, simply unzip it. (updated 2016/8/16)

CreateDeviceCollections

Related Reading

 

 

This entry was posted in PowerShell, queries, Servicing Plans, Updates and Servicing, Windows 10. Bookmark the permalink.

2 Responses to How can I use PowerShell to populate Windows 10 CB, CBB, LTSB and Insider Preview collections in System Center Configuration Manager (Current Branch)

  1. Bob says:

    Ok, now I’m completely confused. This article states that the GPO settings to defer updates are meant to be used for Windows Update for Business (WUfB) only.

    https://home.configmgrftw.com/windows-10-servicing-configmgr-confusion

    Is this another change?

Leave a Reply