The SMSDP Task Sequence variable was around in ConfigMgr 2007 and I used it to get the name of the server where content was being pulled from.
Now in ConfigMgr 2012 the variable has gone. But the good news is you can still find the name of the DP where the content is getting downloaded from by checking the read only task sequence variable starting with _SMSTSHTTP. Starting with… yes the variable is _SMSTSHTTP plus the package been downloaded. For example _SMSTSHTTPSPS20001D.This variable is only populated when content is downloaded from a DP.
The script below will check for the a variable starting with _SMSTSHTTP and if it is set then it will be something like https://PCLABAP2.pclab.local.com/SMS_DP_SMSPKG$/PS20001D. We only want the FQDN of the server name so let’s split on “/” and use the 3rd array, remember arrays start at 0. Now we can set SMSDP to the FQDN of the DP.
One thing I have found when deploying the task sequence that will run the script and set the SMSDP variable the deployment distribution options must be set to “Download content when needed by the running task sequence”. This option will not download the package into the CCM cache but directly into the _SMSTaskSequence folder and this option does not use an Alternate Content Provider (ACP) if present. The content will then get deleted after the task sequence runs. This will force the content to be downloaded every time the task sequence is run.
If the deployment distribution option “Download all content locally before starting the task sequence” is used the package will be downloaded into the CCM cache, not a bad option one may think…but when the task sequence runs a second time on the client the _SMSTSHTTP variable will be empty as the package was not downloaded from a DP because the package was already in the CCM cache.
Now we can get on and use the DP FDQN to our hearts’ content.
Get the script here.