Solved

Alert Notification: Run Command for Powershell script ?

  • 6 May 2021
  • 4 replies
  • 1041 views

Userlevel 1
Badge +3

Hello,

I would like to run a script for each time that a backup fails to create a support ticket.

The alert has been configured and the Powershell script has been tested and validated and works using the following command on the Powershell window:

  • powershell.exe create_ticket.ps1 -s “Title” -d “Description”

I would like Commvault to launch the script with its own tokens such as <CLIENT NAME>.

Using the documentation ressource “Setting Up Command Line Alert Notifications” (source link: https://documentation.commvault.com/commvault/v11/article?p=5401.htm ), I configured the Run Command fields as following:

  • Command executable location: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
  • Arguments: /C powershell.exe C:\tmp\create_ticket.ps1 -s "Backup job failed for <CLIENT NAME>"  -d "`nAlert Title:      <ALERT NAME>`r`nTrigger Time:     <TIME>”

Unfortunately this doesn’t work.

Do you have any advises?

 

Thank you for your answers.

 

Best regards,

John

icon

Best answer by Damian Andre 6 May 2021, 17:44

View original

4 replies

Userlevel 7
Badge +23

Hey @JohnADP - have you tried putting this in a .bat file, and then executing the .bat rather than powershell directly?

 

Wondering if that may solve it.

 

Userlevel 4
Badge +13

@JohnADP can’t you use the built mechanism for sending alert to the ticket system?

//Henke

Userlevel 1
Badge +3

Hello Damian,

I can’t use a .bat file because I need to perform a cURL command that is not available and cannot be installed on the Commserve for security reasons.

The only alternative I have is to use a Powershell script.

 

Hello Henke,

I am using the built-in mechanism to send alert to the ticket system but in order to create a ticket, I need to run a cURL command via the Run Command notification because the Email handler is not convenient for the customer.

Userlevel 7
Badge +23

Hello Damian,

I can’t use a .bat file because I need to perform a cURL command that is not available and cannot be installed on the Commserve for security reasons.

The only alternative I have is to use a Powershell script.

 

Hello Henke,

I am using the built-in mechanism to send alert to the ticket system but in order to create a ticket, I need to run a cURL command via the Run Command notification because the Email handler is not convenient for the customer.

Hey @JohnADP,

Oh, sorry I may not have explained properly. Rather than executing the powershell command directly, put the powershell command in a batch script, and allow commvault to execute the batch script first, which will subsequently fire off powershell. I am just wondering if the command is getting tripped up on all the parameters. In the documentation link you sent, you can run the sample batch to output the variables to know how to match up the tokens to the powershell parameters - i.e <CLIENT NAME> may conform to $1 etc. 

Reply