Skip to content

Instantly share code, notes, and snippets.

@benyoungnz
benyoungnz / Veeam-DataIntegrationAPI-OpswatHashScan.ps1
Created Apr 22, 2022
Veeam Data Integration API with Opswat Metadefender Hash Scanning
View Veeam-DataIntegrationAPI-OpswatHashScan.ps1
Add-PSSnapin VeeamPSSnapin -ErrorAction SilentlyContinue
#connect to your backup server
Connect-VBRServer -Server "YOURBACKUPSERVER"
#get this machine (the data processor) ip address
$targetServer = (Get-NetIPAddress -AddressFamily IPv4 | Select-Object -First 1).IPAddress
$targetServerCreds = Get-VBRCredentials -Name "lab\administrator"
#backup job name
@benyoungnz
benyoungnz / Veeam-JobTotalUtilisationThresholdReport.ps1
Created Mar 28, 2022
Powershell Report script to alert when total backup job size (storage usage) is over a threshold - so you can monitor it and or split jobs into nice chunks if you so desire.
View Veeam-JobTotalUtilisationThresholdReport.ps1
#alert at or over this amount
$alertOverGB = 100;
#your email settings
$emailSettings = @{
To = 'you@example.local'
From = 'backupreports@example.local'
Smtpserver = 'smtp.example.local'
Subject = "{{VBRServer}} jobs over $($alertOverGB)GB"
@benyoungnz
benyoungnz / AlertTo-VeeamOneReceiver.ps1
Last active Nov 22, 2021
AlertTo-VeeamOneReceiver
View AlertTo-VeeamOneReceiver.ps1
param([string]$AlarmName,[string]$ObjectName,[string]$Information,[string]$TriggeredOn,[string]$State,[string]$PreviousState,[int]$AlarmId)
<#
.SYNOPSIS
VeeamOneReciever Alert
.DESCRIPTION
Script to send alarms to the VeeamONEReceiver API
.Notes
NAME: AlertTo-VeeamOneReceiver.ps1
View Veeam-Replica-Disk-Check-Difference.ps1
#enter all VC's you need to connect too, this includes repliction clusters as we need to find the matching VM.
$virtualCenters = @('vc1','vc2')
foreach ($vc in $virtualCenters)
{
Connect-VIServer $vc #connect to the vc
}
$allVMs = Get-VM | Select-Object Name, @{N="Drives"; E={($_ | Get-HardDisk).count }}, ResourcePool
$replicas = $allVMs | Where-Object { $_.Name -like '*_replica' }
@benyoungnz
benyoungnz / VeeamFileReport.ps1
Created Jul 13, 2021
Veeam Dedupe and Compression Ratio from Backup Job
View VeeamFileReport.ps1
$jobName = "Your Backup Job"
$backup = Get-VBRBackup -Name $jobName
if ($backup) {
$backup.GetAllStorages() |
Sort-Object CreationTime -Descending |
Format-Table @{Name="VM"; Expression={$_.PartialPath.ToString().Split('.')[0]}},
# @{Name="Filename"; Expression={$_.PartialPath}}, #uncomment if you want the filename on disk.
@{Name="Data Size GB"; Expression={[math]::Round($_.Stats.DataSize/1GB, 2)}},
@benyoungnz
benyoungnz / getting-started.ps1
Created Feb 20, 2020
Data Integration API from Veeam - Getting Started
View getting-started.ps1
Add-PSSnapin VeeamPSSnapin -ErrorAction SilentlyContinue
#connect to your backup server
Connect-VBRServer -Server "YOURBACKUPSERVER"
#get this machine (the data processor) ip address
$targetServer = (Get-NetIPAddress -AddressFamily IPv4 | Select-Object -First 1).IPAddress
$targetServerCreds = Get-VBRCredentials -Name "lab\administrator"
#backup job name
@benyoungnz
benyoungnz / restartServices.ps1
Created Feb 26, 2019
Windows Service Restart and Slack Log
View restartServices.ps1
#---------------------------------[Slack Setup]---------------------------------
#bot name to post into slack
$slackBotName = "YourSlackBotName"
#your slack webhook key - blank for no trigger
$slackKey = "YOURSLACKWEBHOOK"
#slack channel to post into
$slackChannel = "#YourChannel"
#---------------------------------[Services Setup]---------------------------------