How to clean up RunHistory folder
Every rule execution, including actions performed in the Web Portal, is recorded as an individual report in the Execution History. This data is essential for system monitoring and troubleshooting.
Execution history reports are stored in the Execution History database (Cayo.PolicyManager.RH). To prevent excessive database growth, we recommend cleaning up this database once per month.
Cayosoft Administrator includes a built-in rule:
Home > Rules > Built-in Rules(Pre-configured) > Archive Execution History.
This rule automatically archives and cleans up execution history records by exporting them as HTML files to a specified folder. The rule is fully customizable. You can adjust the cleanup frequency and the destination folder for exported records.
Over time, the folder storing these archived records may become too large. This article explains how to compress archived files into a .zip archive using built-in Windows tools, helping you free up space and avoid errors.
Prepare RunHistory files for archiving (not required since v5.3.2)
Some of Cayosoft Administrator rules contain special character '™' that can cause an error in the work of archiving tools. Cayosoft recommends renaming all files that contain prohibited symbols before running the tool by the PowerShell script below.
This script finds all files with '™' in the folder with RunHistory records and removes the symbol from file names.
How to run the script:
Open the Windows PowerShell command prompt or the Windows PowerShell ISE.
If you customized export path in the Archive Execution History rule you need to change $inputFolder variable value before running the script.
-
Paste the script text below into PowerShell console and press Enter:
$inputFolder = "C:\ProgramData\Cayo Software\AdminAssistant\Reports"
#$charsToReplace = @('™','®','©')
$charsToReplace = @('™')
$charReplaceTo = ''
$RenamedFileNames = @{}
$fileItems = Get-ChildItem -path $inputFolder
foreach ($fileItem in $fileItems)
{
$fileItemName = $fileItem.Name
$fileItemNameNew = $fileItemName
foreach ($charToReplace in $charsToReplace)
{
$fileItemNameNew=$fileItemNameNew.Replace($charToReplace, $charReplaceTo)
}
if ($fileItemName -ne $fileItemNameNew)
{
$fileName= [System.IO.Path]::Combine($inputFolder, $fileItemName)
$fileNameNew= [System.IO.Path]::Combine($inputFolder, $fileItemNameNew)
#Rename-Item -path $fileName -newName $fileNameNew -force
Move-Item -path $fileName -destination $fileNameNew -force
$RenamedFileNames.Add($fileItemName, $fileItemNameNew)
}
}
#$RenamedFileNames
$RenamedFileNames.Count Wait until the script completes, it should show the number of updated files as a result.
How to archive these files by default Windows tool
Windows provides a simple tool that can create a zip archive with files selected in the folder.
Perform the following steps:
Open the RunHistory folder location. By default it is C:\ProgramData\Cayo Software\AdminAssistant\Backup\RunHistory
Select all files in the folder, right-click on them, then select Send to > Compressed (zipped) folder.
As a result, a new compressed folder will appear in the folder. Now you can delete all archived files.
Comments
0 comments
Please sign in to leave a comment.