<< Back to Script Library

Check Ivanti Workspace Control DB Cache folder size and transaction logs

With this action you can check the size of the DB Cache folder and see if there are transaction logs in the transaction folder.
Version: 2.1.3
Created: 2018-12-29
Modified: 2019-10-03
Creator: chris.twiest
Downloads: 21
Tags: Ivanti Workspace Control DB Cache PowerShell
The Script Copy Script Copied to clipboard
$ErrorActionPreference = 'Stop'
    Check Ivanti Workspace Control DB Cache and transaction logs

    Get the size of the Ivanti Workspace Control DB Cache, and if (and how many) transation logs exist

    Can be used to see if the local Ivanti Workspace Control agent is updating the DB and running OK.
    Context: This script can be triggered from: Computer

Modification history: Original script by Chris Twiest
                      29062019 - Ton de Vreede - Added simple error handling, changed output method


Function Feedback {
    Param (
        [Parameter(Mandatory = $true,
            Position = 0)]
        [Parameter(Mandatory = $false,
            Position = 1)]

    # This function provides feedback in the console on errors or progress, and aborts if error has occured.
    If (!$Exception -and !$Oops) {
        # Write content of feedback string
        Write-Host $Message -ForegroundColor 'Green'

    # If an error occured report it, and exit the script with ErrorLevel 1
    Else {
        # Write content of feedback string but to the error stream

        # Display error details
        If ($Exception) {
            $Host.UI.WriteErrorLine("Exception detail:`n$Exception")

        # Exit errorlevel 1
        Exit 1

# Get the DB location
try {
    [string]$Key = 'HKLM:\SOFTWARE\WOW6432Node\RES\Workspace Manager'
    [string]$dbcachepath = (Get-ItemProperty -Path $key -Name LocalCachePath).LocalCachePath
catch {
    Feedback -Message 'The location of the Workspace Control database could not be retreived from the registry. Using default location.'
    $dbcachepath = "$ENV:RESPFDIR\Data\DBcache"

# Get Database size and transactions
try {
    $size = "{0:N2} MB" -f ((Get-ChildItem $dbcachepath -Recurse | Measure-Object -Property Length -Sum -ErrorAction Stop).Sum / 1MB)
    $transactions = Get-ChildItem "$dbcachepath\Transactions"
catch {
    Feedback -Message 'The size and content of the Workspace Control database folder could not be read.' -Exception $_

# Output the results
Feedback -Message "The Ivanti Workspace Control DB cache folder located at $dbcachepath is $size"

if ($transactions -eq $null) {
    Feedback -Message "The transactions folder is empty"
else {
    Feedback -Message "The transactions folder is not empty and contains the following files:`n$transactions.name"