PowerShell Delete App-V Cache

I wrote this little PowerShell script to cleanup the App-V cache for both the shared directory and a user’s data.  Run this script in an elevated PowerShell command (or ISE) window.  Optionally, you can distribute this with ConfigMgr using the below command line. Note that this will need to run with user’s rights in order to access their %appdata% folder.

%windir%\sysnative\windowspowershell\v1.0\powershell.exe -executionPolicy bypass -file .\DeleteAppVCache.ps1

DeleteAppVCache.ps1

$CurrentPolicy = Get-ExecutionPolicy -Scope LocalMachine Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force Import-Module "C:\Program Files\Microsoft Application Virtualization\Client\AppvClient\AppvClient.psd1"

net stop AppVClient Get-AppvClientPackage -All | Remove-AppVClientPackage net stop AppVClient

Set-Location -Path env: Remove-Item C:\ProgramData\App-V\* -recurse

$UserAppData = Get-Content -Path appdata Remove-Item $UserAppData\Microsoft\AppV\Client\Catalog\Packages\* -recurse Remove-Item $UserAppData\Microsoft\AppV\Client\VFS\* -recurse

$UserAppData = Get-Content -Path localappdata Remove-Item $UserAppData\Microsoft\AppV\Client\Integration\* -recurse Remove-Item $UserAppData\Microsoft\AppV\Client\VFS\* -recurse

net start AppVClient Get-AppvPublishingServer | Sync-AppvPublishingServer Set-ExecutionPolicy -ExecutionPolicy $CurrentPolicy -Force

 

email

Written by , Posted .