Skip to content

Instantly share code, notes, and snippets.

@benyoungnz
benyoungnz / Veeam-DataIntegrationAPI-OpswatHashScan.ps1
Created April 22, 2022 05:17
Veeam Data Integration API with Opswat Metadefender Hash Scanning
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 March 28, 2022 22:29
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.
#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 November 22, 2021 00:31
AlertTo-VeeamOneReceiver
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
@benyoungnz
benyoungnz / restartServices.ps1
Created February 26, 2019 20:51
Windows Service Restart and Slack Log
#---------------------------------[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]---------------------------------
#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 July 13, 2021 02:40
Veeam Dedupe and Compression Ratio from Backup Job
$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 February 20, 2020 03:25
Data Integration API from Veeam - Getting Started
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