This article provides instructions for the VSSDiagnosticScriptOnAgent.ps1
PowerShell script. This script is a powerful troubleshooting tool designed to automatically diagnose and resolve a wide range of known issues that can cause Volume Shadow Copy Service (VSS) errors and snapshot failures on an agent machine.
Script Path:
C:\Program Files\AppRecovery\Agent\PowerShellScripts\VSSDiagnosticScript\VSSDiagnosticScriptOnAgent.ps1
Snapshot failures related to the Volume Shadow Copy Service (VSS) can be caused by a variety of underlying system issues. This script is designed to address the following common causes:
AALogs
).The resolution is to run the VSSDiagnosticScriptOnAgent.ps1
PowerShell script, which performs several automated checks and fixes. Please review the following warnings and steps carefully before proceeding.
For user convenience, the script automatically attempts to run the command Set-ExecutionPolicy Unrestricted
. This allows the script to run but is a broad permission change that can be a security concern in some environments.
If you prefer a more secure method that does not change the system's policies, you can first edit the script to disable this automatic change and then run the script using the per-session bypass method.
To do this:
VSSDiagnosticScriptOnAgent.ps1
file in a text editor.Set-ExecutionPolicy Unrestricted
and add a '#' character at the beginning to comment it out (e.g., #Set-ExecutionPolicy Unrestricted
). Save the file.powershell.exe -ExecutionPolicy Bypass -File .\\VSSDiagnosticScriptOnAgent.ps1
The script initiates a chkdsk
command to find and fix logical file system errors or bad sectors on the disk. This is a foundational step, as file system corruption can prevent VSS from operating correctly.
The script runs the disk defragmentation utility to consolidate fragmented files. On mechanical hard disk drives (HDDs), this improves I/O performance and can help VSS operations complete successfully.
The script identifies and deletes Rapid Recovery change logs (aalog*.*
files) from the System Volume Information folder. This action is designed to free up critical space, especially on a full System Reserved Partition (SRP), which is a common cause of VSS failure.
On Hyper-V hosts, the script removes checkpoints from virtual machines. This is intended to clear orphaned "Recovery" checkpoints left behind by previous failed backups, as these can interfere with new snapshot operations.
The script checks if the agent is running inside a VMware VM. This is the first step in diagnosing a common issue where a VM migrated from Hyper-V retains a conflicting "Hyper-V IC Software Shadow Copy Provider". The script's purpose is to resolve this conflict, which likely involves removing the provider.
The script initiates a volume shrink operation. This is not a fix for general disk misalignment but addresses a specific Rapid Recovery error where the partition table metadata is incorrect. Shrinking the volume by a small amount corrects this metadata.