Avatar of Sum Wum
Sum Wum
Flag for Denmark asked on

SCCM 1607 - Update content on application by powershell

Hi,

Once per month I would like a script to download the newest content to our Office 365 suite and thereafter update the content in SCCM 1607. The first part is done. Now I need to update the content of an existing application in SCCM, which I normally do by right-clicking on the application and choose "Update content" and then thereafter remove the old revision of the application.

Does any of you guys know how to do this?
SCCMPowershell

Avatar of undefined
Last Comment
Sum Wum

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Mike T

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Sum Wum

ASKER
Hi Mike,

Thanks! That helped alot. Here is what I ended up with for Office x86 if anyone else could use it. I'll let it run once per month as a scheduled task to update the Office suite and all the other Office applications that we use.

Set-Location -Path "X:\Path\Microsoft Office Suite\2016\x86\"
Remove-Item -Path .\Office -Force -Recurse
Start-Process -FilePath .\setup.exe -ArgumentList "/download .\Download.xml" -Wait -NoNewWindow -PassThru
$ApplicationName = "Microsoft Visio Pro 2016 x64"
$DeploymentType = Get-CMDeploymentType -ApplicationName $ApplicationName
Update-CMDistributionPoint -ApplicationName $ApplicationName -DeploymentTypeName $DeploymentType.LocalizedDisplayName

# Here we go through all the applications and remove all the revisions that is not in use
$SCCMApps = Get-CMApplication
foreach ($SCCMApp in $SCCMApps)
{
      $SCCMAppRevision = $SCCMApp | Get-CMApplicationRevisionHistory
      for ($i = 0;$i -lt $SCCMAppRevision.Count-1;$i++) {Remove-CMApplicationRevisionHistory -name $SCCMApp.LocalizedDisplayName -revision $SCCMAppRevision[$i].CIVersion -Force}
}
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy