Hey there, here’s Martin again.
Today I needed to get the Name of an application based on a Content Id from the ContentTransferManager.log:
CTM job {6B767521-D8A8-410B-A572-AF4F6AFD4457} (corresponding DTS job {1EFC1FD9-C3B1-4B25-B879-18EC8F5CD152}) started download from ‘http://$FQDN_DP/SMS_DP_SMSPKG$/Content_b6256e4e-0278-4264-8e7c-b8fea60684d5.1’ for full content download.
If you would like the command prepared for you in this blog, you have to copy the string Content_b6256e4e-0278-4264-8e7c-b8fea60684d5.1 (correct it to your appropriate string) and open a Powershell session with a User Account that can connect to the SMS Provider Server through WMI. The SCCM cmdlets are not used within this commands. Define the variable $ContenId01 with this command:
$ContenId01 = (("Content_b6256e4e-0278-4264-8e7c-b8fea60684d5.1").Split("."))[0]
Now you can get the values of this deployment type, don’t forget to set your SMS Provider and your SiteCode in the Get-WMIObject command:
Get-WmiObject -Namespace root\sms\site_[YOUR SITECODE] -ComputerName [HERE COMES YOUR SMS PROVIDER!] -Class SMS_Deploymenttype -Filter "ContentID = '$ContenId01'
But we don’t need all of the Information, we only Need the AppModelName Instance, so we put this value into a variable:
$ApplicationID = (Get-WmiObject -Namespace root\sms\site_[YOUR SITECODE] -ComputerName [HERE COMES YOUR SMS PROVIDER!] -Class SMS_Deploymenttype -Filter "ContentID = '$ContenId01' and PriorityInLatestApp = '1'").AppModelName
With this Information, we now can kindly ask the class SMS_Application to tell us the Name of the Application. This PoSh-Command will serve us this:
(Get-WmiObject -Namespace root\sms\site_[YOUR SITECODE] -ComputerName [HERE COMES YOUR SMS PROVIDER!] -Class SMS_Application -Filter "CI_UniqueID like '$ApplicationID%' and IsLatest = 'True'").LocalizedDisplayName
Your Powershell console should look like this:
Hope this helps someone in the same adventure 🙂
Hi, great script! Makes my life much easier 🙂
I simplified the readability of your script a little bit:
# Settings
$SiteCode = ‘A00’
$Server = ‘KSQLAPPSC01’
$ContentID = ‘Content_b051377e-9e9d-4355-a3af-f5f4fc6cecaf.1’
Get-WmiObject -Namespace rootsmssite_$SiteCode -ComputerName $Server -Class SMS_Deploymenttype -Filter “ContentID = ‘$($ContentID.Split(“.”)[0])'” | Select LocalizedDisplayName -Unique
Hi Kenneth, thank you for your Feedback.
Thanks for the script, this helped me out a great deal!
Hey Kenneth I tried you script with no success
# Settings
$SiteCode = ‘US3’
$Server = ‘Servername from CAS.log’
$ContentID = ‘Content_bcffbcbb-6fbb-4b9d-b816-8c20b8e2fa13.1’
Get-WmiObject -Namespace rootsmssite_ $SiteCode -ComputerName $Server -Class ccm_Deploymenttype -Filter “ContentID = ‘$($ContentID.Split(“.”)[0])’” | Select LocalizedDisplayName -Unique
Hey,
when you are copy/paste please check for correct characters like the “
Martin is correct, A copy and paste into notepad or notepad++ has non standard single and double quotes. Which I found PowerShell wouldn’t interpret correctly and had to replacement all.
In this line
“Get-WmiObject -Namespace rootsmssite”
change to
“Get-WmiObject -Namespace root\sms\site”
thanks for this comment, those missing “\” came from the migraton of the blog (was previously on another)