Jump to content


anyweb

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

Recommended Posts

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.

query-and-exclusion.png

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

populated-1024x728.png

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.png

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.png

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.png

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.png

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.png

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-1024x728.png

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

collections-populated-1024x728.png

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 inner join SMS_G_System_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_R_System.OSBranch = 0 and SMS_R_System.OperatingSystemNameandVersion = “Microsoft Windows NT Workstation 10.0”

  • 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”

  • 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”

  • 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” and (SMS_G_System_OPERATING_SYSTEM.BuildNumber != “10586” and SMS_G_System_OPERATING_SYSTEM.BuildNumber != “10240”)

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.

CreateDeviceCollections

Related Reading

 

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.