Reset WEM - Registry Settings

Version: 1.2.25
Creator Name: timriegler
Date Created: 2017-07-11
Date Modified: 2019-05-20
Scripting language: PS
Download Count: 25

Reset registry key where WEM registry settings are stored.
Tags: WEM, Citrix,

The Script

<# 
.SYNOPSIS
    Remove ControlUp Registry settings in the cache in the logged on user's registry
.DESCRIPTION
    The registry cache occassionally becomes corrupted. This SBA will remove the WEM cache for only
    the registry settings. A WEM refresh on the agent / VDA is required to complete the refresh. You
    may also log the user off / back on again.
.PARAMETER RegPath
    Path to the registry cache
.NOTES
    Created by Tim Riegler
#>

$RegPath = 'HKCU:\Software\VirtuAll Solutions\VirtuAll User Environment Manager\Agent\Tasks Exec Cache\RegistryValues\*'

# Check if the item exists and delete all sub-keys.
Try {
    If (Test-Path (get-childitem $RegPath)) {
        Write-Host "Key Exists! Deleting exisitng key..."
        # Remove-Item -Path HKCU:\CurrentVersion\* -Recurse
        Remove-Item -Path $RegPath -Recurse
    } 
}
Catch {
    Throw "Key does NOT exist. Exiting."
    Exit 1
}


Write-Host 'Registry Key reset. Please use WEM Admin Console to refresh the workspace agent on this host:' $env:computername