While right-clicking an applications deployment type(s), we can select Update Content. Is there a way of doing this action using Powershell or a WMI-method?
Asked
Active
Viewed 9,357 times
0
-
WMI is to pull information from the system. I don't know the powershell option, however why not schedule this installed under the data source of the application to update the distribution points? – Cold T May 23 '13 at 12:51
3 Answers
2
I'm currently using this powershell script to update the content of all applications, only caveat is, the revision always gets increased:
try
{
Get-Wmiobject -Namespace "root\SMS\Site_<sitecode>" -Class SMS_Application -Filter "isLatest='true' and isExpired='false'" | foreach{
$name = $_.LocalizedDisplayName
echo "Application : $name"
$dptypes = Get-CMDeploymentType -ApplicationName "$name"
foreach ($dpt in $dptypes){
$dptname = $dpt.LocalizedDisplayName
echo "Deployment Type: $dptname"
Update-CMDistributionPoint -ApplicationName "$name" -DeploymentTypeName "$dptname"
}
}
}
catch
{
$_.Exception.Message
}

daviscodesbugs
- 103
- 3

fokker
- 21
- 3
1
Set-CMDeploymentType with -ContentLocation will force an update, even if the ContentLocation is set to the same as the original.
My code looks like this:
$app = Get-CMApplication -Name $PackageName
$depType = $app | Get-CMDeploymentType
$depType | Set-CMDeploymentType -MsiOrScriptInstaller -ProductCode $productCode -ContentLocation $PkgRead
The existing location can be trickier to determine - if you don't already know where it is, you can pull it out of the deployment type XML or WMI.

Lamarth
- 136
- 2
0
After some intense searching I found a solution. In the SCCM SDK there's a WMI class called SMS_ContentPackage, which has the public method Commit(). Using this I was able to update content on all applications, using the following Powershell-code on the server:
foreach($application in Get-CMApplication){
$Get_WmiObject = @{
'Namespace' = 'root\SMS\Site_<SiteCode>';
'Class' = 'SMS_ContentPackage';
'Filter' = "PackageID='$($application.PackageId)'";
}
(Get-Wmiobject @Get_WmiObject).Commit() | Out-null
}

VertigoRay
- 272
- 1
- 3
- 9

Chrizmo
- 161
- 1
- 8
-
I'm trying to accomplish this as well, and your answer doesn't appear to be working for me. I am able to run the commit method, but it doesn't update the package. When running Get-CMApplication, I see that the SDMPackageVersion does not change, and the SDMPackageXML still reflects the old content. When I hit "Update Content" through the SCCM console, those values are updated to reflect the new content. – Jason Sypkens Aug 02 '13 at 20:31
-
-
No - it doesn't - I just tested again to be sure. I then manually hit "Update Content" on the deployment type, and the revision number was increased by 1. – Jason Sypkens Aug 09 '13 at 19:03
-
If you ommit piping the output to Out-Null, do you get a response? Also, I don't know if it matters, but this was done on SCCM 2012 SP1, are you using that as well? – Chrizmo Aug 09 '13 at 20:23
-
Response is "returnvalue: 0" (with a bunch of other WMI fluff to go with it). It is on SCCM 2012 SP1. – Jason Sypkens Aug 10 '13 at 02:14