Powershell script for backup summary reports
-
I recently developed a PowerShell script that fills a need that I couldn't find with the built-in reporting options for Xen Orchestra backups.
The script is available on GitHub, It works with PowerShell 7 (if using self-signed certs and using the SkipCertificateCheck parameter), otherwise it may work with Windows Powershell 5, I just didn't get a chance to test that yet.
The script connects to your Xen Orchestra server via REST API and generates HTML reports that combine:
Complete backup job inventory - Shows all configured VM backups, metadata backups, and replication jobs
Execution status correlation - Matches job definitions with recent execution history to show what's actually running vs. what's configured
Professional reporting - Clean HTML output with a list of all configured backups jobs and their most recently run status within the last 24 hours (configurable)
Automated delivery - Optional email integration for scheduled reporting
Why I Built This
Managing backup jobs across multiple pools and sites, I found myself constantly logging into XO to check backup status and manually correlating job definitions with execution results. This script automates that entire process and provides the kind of professional reports that management actually wants to see.
Sample Output
The reports include a summary showing success/failure counts, job definitions organized by type with current status, and detailed execution logs with timing information. The HTML is optimized for both email delivery and web viewing.
The README includes detailed documentation and real-world usage examples. I've also included sample reports so you can see exactly what output to expect.
Getting Started
Basic usage is straightforward with additional options available:
.\Get-XenOrchestraBackupReport.ps1 -XenOrchestraUrl "https://xo.company.com" -ApiToken "your-token" -OutputPath "backup-report.html"
Would love feedback from the community
-
seems neat... but can't auth... it says my token is not good
=== Enhanced Xen Orchestra Backup Report Generator ===
Starting backup job definitions and execution status retrieval...
[2025-09-25 23:51:16] [Information] Script execution started
[2025-09-25 23:51:16] [Information] Using API token provided via command line parameter
[2025-09-25 23:51:16] [Information] Connecting to Xen Orchestra at: https://10.<redacted>
[2025-09-25 23:51:16] [Information] Testing authentication...
Write-Log : [2025-09-25 23:51:16] [Error] Script execution failed: Failed to authenticate with Xen Orchestra using
provided API token
Au caractère E:\Téléchargements\Get-XenOrchestraBackupReport.ps1:1825 : 5-
Write-Log $errorMessage -Level Error
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
- FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-Log
Script execution failed: Failed to authenticate with Xen Orchestra using provided API token
Write-Log : [2025-09-25 23:51:16] [Error] Stack Trace: à <ScriptBlock>,
E:\Téléchargements\Get-XenOrchestraBackupReport.ps1 : ligne 1658
à <ScriptBlock>, <Aucun fichier> : ligne 1
Au caractère E:\Téléchargements\Get-XenOrchestraBackupReport.ps1:1829 : 9-
Write-Log "Stack Trace: $($_.ScriptStackTrace)" -Level Error
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
- FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-Log
Failed to authenticate with Xen Orchestra using provided API token
Au caractère E:\Téléchargements\Get-XenOrchestraBackupReport.ps1:1658 : 13-
throw "Failed to authenticate with Xen Orchestra using pr ...
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : OperationStopped: (Failed to authe...vided API token:String) [], RuntimeException
- FullyQualifiedErrorId : Failed to authenticate with Xen Orchestra using provided API token
I tried with token created by the XOA ui, and by xo-cli
either way i'm a global admin of XOA with my user?
-
-
Adding @Team-DevOps in the loop
-
I'm on PWS 5.1, here is the debug log. 5.1 is the culprit ?
[2025-09-25 23:59:46] [Information] Script execution started
[2025-09-25 23:59:46] [Debug] PowerShell Version: 5.1.26100.6584
[2025-09-25 23:59:46] [Information] Using API token provided via command line parameter
[2025-09-25 23:59:46] [Information] Connecting to Xen Orchestra at: https://10.
[2025-09-25 23:59:46] [Information] Testing authentication...
[2025-09-25 23:59:46] [Debug] API Call Attempt 1: GET https://10./rest/v0/vms
[2025-09-25 23:59:46] [Debug] Configuring custom SSL certificate validation (PS 5.1)
[2025-09-25 23:59:46] [Debug] Cookie authentication failed, trying Bearer token...
[2025-09-25 23:59:46] [Debug] API Call Attempt 1: GET https://10./rest/v0/vms
[2025-09-25 23:59:46] [Debug] Configuring custom SSL certificate validation (PS 5.1)
[2025-09-25 23:59:46] [Error] Script execution failed: Failed to authenticate with Xen Orchestra using provided API token
[2025-09-25 23:59:46] [Error] Stack Trace: à <ScriptBlock>, E:\Téléchargements\Get-XenOrchestraBackupReport.ps1 : ligne 1658
à <ScriptBlock>, <Aucun fichier> : ligne 1
[2025-09-25 23:59:46] [Debug] Script cleanup completed -
@Pilow I was using Powershell 7. If you are using a self-signed certificate on the XOA server then you'll have issues as the -SkipCertificateCheck parameter isn't available for the Invoke-RestMethod command in Powershell 5.
-
ok, installed pws 7
and it's working
-
Whoo this looks very nice! Thank you for sharing this tool with us!