PowerShell Delete App-V Cache

Posted on Updated on

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

Script updated/fixed 6/5/2014

 

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
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s