Skip to content

Instantly share code, notes, and snippets.

Last active November 22, 2021 00:31
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save benyoungnz/32c0503ee49f5744a5d6a2cc98c2de95 to your computer and use it in GitHub Desktop.
VeeamOneReciever Alert
Script to send alarms to the VeeamONEReceiver API
NAME: AlertTo-VeeamOneReceiver.ps1
LASTEDIT: 23/11/2021
#if you are posting from PS 5, youll need this. Otherwise delete and add -SkipCertificateCheck to the IRM.
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
#where your VeeamOneReceiver is located.
$receiverAPI = "https://{yourhost:port}/api/alarm"
#the alarm object, we will convert to JSON for posting
$alarm = [pscustomobject]@{
alarmName = $AlarmName
objectName = $ObjectName
information = $Information
triggeredOn = $TriggeredOn
alarmState = $State
alarmPreviousState = $PreviousState
alarmId = $AlarmId
} | ConvertTo-Json
#fire in the hole!
Invoke-RestMethod -Uri $receiverAPI -Method Post -body $alarm -ContentType "application/json" #-SkipCertificateCheck
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment