#1 Global Leader in Data Resilience

How to Run Scripts With Veeam One Client

KB ID: 1552
Product: Veeam ONE | 12 | 12.1 | 12.2 | 12.3
Published: 2012-03-11
Last Modified: 2024-08-14
mailbox
Get weekly article updates
By subscribing, you are agreeing to have your personal information managed in accordance with the terms of Veeam's Privacy Notice.
This site is protected by hCaptcha and its Privacy Policy and Terms of Service apply except as noted in our Privacy Policy.

Cheers for trusting us with the spot in your mailbox!

Now you’re less likely to miss what’s been brewing in our knowledge base with this weekly digest

error icon

Oops! Something went wrong.

Please, try again later.

Purpose

This article provides additional information about running scripts with Veeam ONE Client.

Solution

Script Configuration

Scripts can be configured for the following action types:

  • As an alarm notification action — select this option if you want to run a custom script when the alarm is triggered or when the alarm status changes. By running a script, you can automate routine tasks that you normally perform when specific alarms fire. For example, if a critical system is affected, you may need to immediately open a ticket with in-house support or perform corrective actions that will eliminate the problem.
Notification action script
  • As an alarm remediation action — using this option, you can specify what actions must be performed after the alarm is triggered or after the alarm status changes.
alarm action script

Script Arguments

You can use the following parameters in the command line for running the script: 

  • %1 — alarm name
  • %2 — affected node name
  • %3 — alarm summary
  • %4 — date and time of alarm trigger
  • %5 — alarm status
  • %6 — previous alarm status
  • %7 — ID assigned to a combination of an affected node and an alarm
  • %8 — type of a child alarm object.

Note: The executable script file must be located on the machine running the Veeam ONE Server component.

Script Examples

Below are examples of how a script can be used with the arguments passed from Veeam ONE Client.

Example 1: Logging Alarm Notifications to a File

In this example, 3 variables will be passed from Veeam ONE Client to a PowerShell script, and that script will use those variables as arguments to generate a log file listing the alarm's state changes.

Notification Action Configuration
Edit the Alarm, and add a 'Run script' action, and for the value specify the script and include the variables that will be passed to that script. For this example, the action value is:

powershell.exe C:\scripts\alarm.ps1 '%1' '%5' '%2'
example
Script Contents
The alarm.ps1 script file contains:
# Assign input arguments to variables
$alarmName=$args[0]
$alarmState=$args[1]
$objectName=$args[2]

# Format Text using Variables
$Text="$(Get-Date)" + "`r`n" + "$alarmName" + " alarm goes ->" + "$alarmState" + " on VM " + "$objectName" + "`r`n"

# Append text to log file.
$Text | Out-File E:\script\output.log -Append

Output Example
After alarms have triggered, the output.log should look similar to this: 


 

 

Example 2: Veeam ONE notifications via MS Teams and Slack

More Information

With this understanding, you should be able to write any script needed for your environment using variables from Veeam ONE alarms.

If you have any further scripting questions or issues, contact Veeam Support, and we will help you to the best of our ability per our support policy.

To submit feedback regarding this article, please click this link: Send Article Feedback
To report a typo on this page, highlight the typo with your mouse and press CTRL + Enter.

Spelling error in text

This site is protected by hCaptcha and its Privacy Policy and Terms of Service apply except as noted in our Privacy Policy.
Thank you!

Thank you!

Your feedback has been received and will be reviewed.

Oops! Something went wrong.

Please, try again later.

You have selected too large block!

Please try select less.

KB Feedback/Suggestion

This form is only for KB Feedback/Suggestions, if you need help with the software open a support case

By submitting, you are agreeing to have your personal information managed in accordance with the terms of Veeam's Privacy Notice.
This site is protected by hCaptcha and its Privacy Policy and Terms of Service apply except as noted in our Privacy Policy.
Verify your email to continue your product download
We've sent a verification code to:
  • Incorrect verification code. Please try again.
An email with a verification code was just sent to
Didn't receive the code? Click to resend in sec
Didn't receive the code? Click to resend
Thank you!

Thank you!

Your feedback has been received and will be reviewed.

error icon

Oops! Something went wrong.

Please, try again later.