:::: MENU ::::

Disable Enterprise Vault Cache

This script will disable Symantec Enterprise Vault cache for all users. Designed to be used on logon, run once.

$VaultCacheRegPath = "HKCU:\Software\KVS\Enterprise Vault\Client"

#Setting the list
$EVlist = @()

#Getting all of the Store ID subkeys from the client key.
$EVsubkeys = Get-ChildItem -Path $VaultCacheRegPath
foreach ($subkey in $EVsubkeys) {
    if ($subkey.PSChildName.Length -match 32) {
        $EVlist += $subkey}}

# Setting OVEnabled under "HKCU:\Software\KVS\Enterprise Vault\Client" to 0.
$ClientKeyProperty = Get-ItemProperty -Path $VaultCacheRegPath
if ($ClientKeyProperty.OVEnabled -eq $Null) {New-ItemProperty -Path $VaultCacheRegPath -Value 0 -Name "OVEnabled" -PropertyType "DWORD"}
else {Set-ItemProperty -Path $VaultCacheRegPath -Value 0 -Name "OVEnabled"}

# Setting OVEnabled under "HKCU:\Software\KVS\Enterprise Vault\Client\%VaultCacheStoreID%" to 0.
if ($EVlist.count -gt 0) {
    foreach ($Vault in $EVlist) {
        $VaultCacheRegPathWithSerial = $VaultCacheRegPath + '\' + $Vault.PSChildName
        if (((Get-ItemProperty -Path $VaultCacheRegPathWithSerial).ovenabled) -ne $null) {
            Set-ItemProperty -Path $VaultCacheRegPathWithSerial -Name "OVEnabled" -Value 0 -Force
            #Deleting the local vault cache, itself from disk.
            $OVRootDirectory = Get-ItemProperty -Path $VaultCacheRegPathWithSerial -Name "OVRootDirectory" | Select-Object -ExpandProperty "OVRootDirectory"
            $OVRootDirectory += $Vault.PSChildName
                if (Test-Path -Path $OVRootDirectory){Remove-Item -Path $OVRootDirectory -Recurse -Force}}}}