Menu
CCMEXEC.COM – Enterprise Mobility
  • Home
  • General
  • Configuration Manager
  • Windows 10
  • Intune
  • About the author
  • GitHub
CCMEXEC.COM – Enterprise Mobility

Show DP information during OSD using TSBackground

Posted on June 28, 2022June 28, 2022 by Jörgen Nilsson

One request that was made many times in the comments of the blog posts on TSBackground which is a remarkable tool from Johan Schrewelius, is to be able to show which DP is being used during OSD. I will try to explain the challenges with displaying DP information using TSBackground and some ways of doing it. The existing variable can be used without TSBackground as well of course to tattoo the registry for example with DPs used.
Which will give us the following result.

Sample TSBackground

More information about TSBackground can be found here:
https://onevinn.schrewelius.it/Apps01.html and here https://ccmexec.com/2019/06/tsbackground-for-configmgr/
Displaying Management Point used is easy there is a Task Sequence variable that contains the MP used, “_SMSTSMP”. When it comes to displaying the Distribution Point used it is way more challenging. When the Task Sequence starts it check that all necessary content is available on the DP(s) used before the TS starts. This makes sense otherwise it will fail anyway when it runs, better to stop it before it starts. More than one DP can exist in the same boundary group and then more than one is listed. When the Task Sequence runs and there are more than one DP it will choose one randomly and potentially use more than one DP during OSD.

The following Task Sequence variables are created that can be used.

_SMSTSxxxxx variable

If “Copy the content in this package to a package share on distribution points:” is checked as shown below those packages will be added to a variable with the name “_SMSTSxxxx” where xxx stands for packageid.

Copy to package share

For the packages that are not copied to a Package share on the DPs the information is blank as show in the table below.

_SMSTSxxxxx variables

_SMSTSHTTPxxxx variable

Each package referenced is also added to a variable with the name _SMSTHTTPxxxx where xxxx reflects the packageID as shown below.

_SMSTSHTTPxxxx variables

The challenge of using this variable is that each DP can be represented more than once depending on HTTPS configuration on the DPs. For my boot image which I have on two DP’s in the Boundary for the client we will have four entries for content location.

_SMSTSLastContentDownloadLocation variable

This variable shows the latest content location used during OSD. Note: that if “Run from DP” is selected for the Task Sequence this variable will be empty during the whole time the Task Sequence runs expect if Applications are being deployed during the Task Sequence they will download the content and show up in the variable. Example of TS variable content is shown below.

_SMSTSLastContentDownloadLocation variable

Options that can be used together with TSBackground.

TSBackground is a great tool where we can customize the “General.xaml” file where we can modify what is being displayed during OSD.
Looking at the options we have I have created a little script that I run in the beginning of the Task Sequence that will create a new variable “OSDDPS” that contains the HTTPLocations where my BootImage is available when the Task Sequence starts. Reason for it is that the boot image used has its own variable, _SMSTSBootImageID. Using that we can calculate the name of the _SMSTSHTTPxxxxx variable for the boot image, in my example “_SMSTSHTTP060001AF”

_SMSTSBootImageID variable

I use this PowerShell script to calculate the DP(s) where the BootImage is available in the Boundary Group when the Task Sequence starts.

$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
$BootImageID = "_SMSTSHTTP" + $tsenv.Value('_SMSTSBootImageID')
$BootImageDPs = $tsenv.Value($BootImageID)
$servers = @()

foreach ($location in $BootImageDPs.Split(',')) {
    $url = "{0}/{1}/{2}" -f $location.Split('/').Trim()
    $server = $url.Replace("HTTPS://", "").Replace("HTTP://", "").Replace("https://", "").Replace("http://", "")
    $servers += $server
}
$uniqueLocations = $servers | select -Unique
$struniqueLocations = $uniqueLocations -join ","
$tsenv.Value('OSDDPS') = $struniqueLocations

I run it early in my Task Sequence to make the variable available as soon as possible in my Task Sequence.

Get Used DP script

Then I update the “General.xaml” file in the TsBackground source files with the following rows.

General.xaml with DP information

I also add the _SMSTSLastContentDownloadLocation to my General.xaml file.

General.xaml with last used location

The result looks like this where Distribution Point(s) represents all DPs where the client can download the bootimage from in the Boundary Group.
And Last used content location is the last DP used to download content from.

As TSbackground updates the variables every second it will update the last used content location dynamically. IF Run TS from distribution point is used the Last used content location will be empty as nothing is downloaded. As shown in the example below. This client is in a boundary group with only one DP as well.

Sample when Run from DP is used

None of these options are perfect but adds information about which DPs are used which can be useful for troubleshooting and looks nice when added to the TSBackground as well. The sample General.xaml used can be downloaded here together with the script. https://github.com/Ccmexec/MEMCM-OSD-Scripts/tree/master/TSBackground

  • Task Sequence DP information
  • TSBackground
  • 1 thought on “Show DP information during OSD using TSBackground”

    1. RAGHAV SOOD says:
      July 10, 2022 at 10:10 pm

      Thanks for this blog. It is really helpful.

      I am having one scenario, During OSD deployment to bare metal device Device is getting content from primary DP not from local DP which is configured for that site. Using Boot media.

      – Boundaries are fine.
      – DP has content as well.
      – Copy the content in this package to a package share on distribution points – Enabled.

      Not sure what I am missing.

      Reply

    Leave a Reply Cancel 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.

    My name is Jörgen Nilsson and I work as a Senior Consultant at Onevinn in Malmö, Sweden. This is my blog where I will share tips and stuff for my own and everyone elses use on Enterprise Mobility and Windows related topics.
    All code is provided "AS-IS" with no warranties.

    Tweets by ccmexec

    Recent Posts

    • Logging the Co-management and Defender onboarding process during OSD
    • Show DP information during OSD using TSBackground
    • Using Install-language during AutoPilot Windows 11 insider
    • Co-Management and the importance of device token enrollment.
    • Windows 11 Insider Start Menu layout registry customizations

    ©2022 CCMEXEC.COM – Enterprise Mobility | WordPress Theme by Superb Themes
    This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.Accept Reject Read More
    Privacy & Cookies Policy

    Privacy Overview

    This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
    Necessary
    Always Enabled
    Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
    Non-necessary
    Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
    SAVE & ACCEPT