Back to Basics – Restoring the SMSDP Variable

Once upon a time, in a ConfigMgr environment far, far away. There was a variable named SMSDP… 🙂

There are times when its useful to figure out what DP you are currently using, and back in ConfigMgr 2007, when integrated with MDT, there was a variable for that: The SMSDP variable .

Here is a script for ConfigMgr Current Branch that sets that variable:

# Script for setting the SMSDP variable in ConfigMgr Current Branch
# Credits to Phil Schwan (@philschwan) for early VBScript version (2013)
# Author: Johan Arwidmark (@jarwidmark)

# Create TS environment object
$TSEnv = New-Object -ComObject Microsoft.SMS.TSEnvironment

# Get the boot image package ID
$BootImagePackageID = $TSEnv.Value("_SMSTSBootMediaPackageID")

# Get DP from _SMSTSHTTP variable for boot image package
$SMSDPUri = [System.Uri]"$($TSEnv.Value("_SMSTSHTTP$BootImagePackageID"))"

# Set SMSDP Variable 
$TSEnv.Value("SMSDP") = $SMSDP

Just paste the above script in a Run PowerShell Script action in the task sequence, and you're all set.

Setting the SMSDP variable in a task sequence

To verify the variable in WinPE, start PowerShell, and type in the following:

$TSEnv = New-Object -ComObject Microsoft.SMS.TSEnvironment
About the author

Johan Arwidmark

5 3 votes
Article Rating
Notify of
Oldest Most Voted
Inline Feedbacks
View all comments
Lars Malmgren
Lars Malmgren
7 months ago

If I have a Status Message Query for a deployment, do I see that info?