Remove all unpublished apps to clear package cache

Often I see queries related to clearing leftover package files after unpublishing them. And so here is a sample powershell code to remove all unpublished packages from the system to clear the space they were occupying in the package store.


$allpackages= Get-AppvClientPackage -all|Where-Object {$_.IsPublishedToUser -like "False" -and $_.IsPublishedGlobally -like "False"} | select Name

$unpublished=$allpackages.name

ForEach($package in $unpublished)

{

Write-Host "$package"

Remove-AppvClientPackage "$package"

Write-Host "$package" removed.

}

NOTE: Test the code in a lab environment, as it doesn't support any error handling.

Comments

Popular posts from this blog

Add custom scripts in AppxManifest.xml file using App-V 5.1 Sequencer

UAC and App-V 5.0 Demystified

Decrypting how Microsoft Teams new MSI works