-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathList Devices being Backed Up.ps1
More file actions
64 lines (54 loc) · 2.11 KB
/
Copy pathList Devices being Backed Up.ps1
File metadata and controls
64 lines (54 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<#
TITLE: Veeam - List Devices being Backed Up [WIN]
PURPOSE: Displays the devices that are being backed up in Veeam B&R
CREATOR: Dan Meddock
CREATED: 17OCT2023
LAST UPDATED: 31OCT2023
#>
# Declarations
$varString = "Veeam Backup & Replication"
$installCheck = ("HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall","HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall") | % {gci -Path $_ | % {get-itemproperty $_.pspath} | ? {$_.DisplayName -eq "$varString"}}
# Main
Try{
If ($installCheck -ne $NULL){
# Import the Veeam PowerShell snap-in module
Add-PSSnapin -Name VeeamPSSnapIn
# Get all Veeam backup jobs
$backupJobs = Get-VBRJob
if ($backupJobs) {
# Specify the path for the output CSV file
$outputPath = "C:\temp\VMbackups.csv"
# Create an array to store the backup job details
$backupJobDetails = @()
foreach ($job in $backupJobs) {
# Get the list of VMs included in the backup job
$backupVMs = Get-VBRJobObject -Job $job
foreach ($vm in $backupVMs) {
$jobDetails = [PSCustomObject]@{
"Job Name" = $job.Name
"VM Name" = $vm.Name
# Add more properties as needed
}
$backupJobDetails += $jobDetails
}
}
# Export the backup job details to a CSV file
$backupJobDetails | Export-Csv -Path $outputPath -NoTypeInformation
write-host "$backupJobDetails"
Write-Host "Backup job details exported to: $outputPath"
} else {
Write-Host "No backup jobs found."
}
# Output results to stdout in DattoRMM
type "C:\temp\vmBackups.csv"
# Remove the Veeam PowerShell snap-in module
Remove-PSSnapin -Name VeeamPSSnapIn
}else{
Write-Host "Veeam Backup and Replication is not installed on this device."
Exit 1
}
}catch{
# Catch any errors thrown and exit with an error
Write-Error $_.Exception.Message
}
Exit 0