-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
michael wisniewski
committed
Feb 24, 2025
0 parents
commit 26f2f15
Showing
1 changed file
with
147 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Import Required Modules\n", | ||
"Import the required PowerShell modules for Veeam operations. This includes any custom or official modules needed to manage Veeam backup operations." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Import the required PowerShell modules for Veeam operations\n", | ||
"Import-Module Veeam.Backup.PowerShell" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Establish Veeam Connection\n", | ||
"Use the appropriate PowerShell cmdlets to establish a connection to the Veeam Backup Server. Ensure proper credentials and connection settings are provided." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Establish Veeam Connection\n", | ||
"# Use the appropriate PowerShell cmdlets to establish a connection to the Veeam Backup Server.\n", | ||
"# Ensure proper credentials and connection settings are provided.\n", | ||
"\n", | ||
"# Define the Veeam Backup Server and credentials\n", | ||
"$VeeamServer = \"YourVeeamServer\"\n", | ||
"$Username = \"YourUsername\"\n", | ||
"$Password = ConvertTo-SecureString \"YourPassword\" -AsPlainText -Force\n", | ||
"$Credential = New-Object System.Management.Automation.PSCredential ($Username, $Password)\n", | ||
"\n", | ||
"# Connect to the Veeam Backup Server\n", | ||
"Connect-VBRServer -Server $VeeamServer -Credential $Credential" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Define Time Range for Past 7 Days\n", | ||
"Define the date range for the past seven days using PowerShell date manipulation techniques. This will determine the start and end dates for filtering backup jobs." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Define Time Range for Past 7 Days\n", | ||
"$EndDate = Get-Date\n", | ||
"$StartDate = $EndDate.AddDays(-7)\n", | ||
"\n", | ||
"# Display the defined time range\n", | ||
"Write-Output \"Start Date: $StartDate\"\n", | ||
"Write-Output \"End Date: $EndDate\"" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Retrieve Backup Jobs\n", | ||
"Query the Veeam Backup Server using the defined time range to retrieve all backup jobs that ran during that period. Use filtering and sorting as needed." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Retrieve Backup Jobs\n", | ||
"# Query the Veeam Backup Server using the defined time range to retrieve all backup jobs that ran during that period.\n", | ||
"\n", | ||
"# Get all backup sessions within the specified time range\n", | ||
"$BackupSessions = Get-VBRBackupSession | Where-Object {\n", | ||
" $_.CreationTime -ge $StartDate -and $_.CreationTime -le $EndDate\n", | ||
"}\n", | ||
"\n", | ||
"# Sort the backup sessions by creation time\n", | ||
"$SortedBackupSessions = $BackupSessions | Sort-Object CreationTime\n", | ||
"\n", | ||
"# Display the backup jobs\n", | ||
"$SortedBackupSessions | ForEach-Object {\n", | ||
" Write-Output \"Job Name: $($_.JobName)\"\n", | ||
" Write-Output \"Start Time: $($_.CreationTime)\"\n", | ||
" Write-Output \"End Time: $($_.EndTime)\"\n", | ||
" Write-Output \"Status: $($_.Result)\"\n", | ||
" Write-Output \"----------------------------------------\"\n", | ||
"}" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Display Backup Jobs\n", | ||
"Format and display the retrieved backup jobs using output cmdlets. Optionally, you can include logic to present the results in a user-friendly table format." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Display Backup Jobs\n", | ||
"# Format and display the retrieved backup jobs using output cmdlets.\n", | ||
"# Optionally, you can include logic to present the results in a user-friendly table format.\n", | ||
"\n", | ||
"# Create a custom object for each backup session to format the output\n", | ||
"$FormattedBackupSessions = $SortedBackupSessions | ForEach-Object {\n", | ||
" [PSCustomObject]@{\n", | ||
" JobName = $_.JobName\n", | ||
" StartTime = $_.CreationTime\n", | ||
" EndTime = $_.EndTime\n", | ||
" Status = $_.Result\n", | ||
" }\n", | ||
"}\n", | ||
"\n", | ||
"# Display the formatted backup sessions in a table format\n", | ||
"$FormattedBackupSessions | Format-Table -AutoSize" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"language_info": { | ||
"name": "python" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |