Skip to content

Latest commit

 

History

History
 
 

jobAlertRecipients

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Add and Remove Job Alert Recipients using PowerShell

Warning: this code is provided on a best effort basis and is not in any way officially supported or sanctioned by Cohesity. The code is intentionally kept simple to retain value as example code. The code in this repository is provided as-is and the author accepts no liability for damages resulting from its use.

This script adds and removes alert email recipients from all protection jobs/groups on a cluster.

Download the script

Run these commands from PowerShell to download the script(s) into your current directory

# Download Commands
$scriptName = 'jobAlertRecipients'
$repoURL = 'https://raw.githubusercontent.com/bseltz-cohesity/scripts/master/powershell'
(Invoke-WebRequest -Uri "$repoUrl/$scriptName/$scriptName.ps1").content | Out-File "$scriptName.ps1"; (Get-Content "$scriptName.ps1") | Set-Content "$scriptName.ps1"
(Invoke-WebRequest -Uri "$repoUrl/cohesity-api/cohesity-api.ps1").content | Out-File cohesity-api.ps1; (Get-Content cohesity-api.ps1) | Set-Content cohesity-api.ps1
# End Download Commands

Components

  • jobAlertRecipients.ps1: the main powershell script
  • cohesity-api.ps1: the Cohesity REST API helper module

Place the files in a folder together and run the main script like so:

# Command line example
./jobAlertRecipients.ps1 -vip mycluster `
                         -username myuser `
                         -domain mydomain.net `
                         -addAddress myuser1@mydomain.net, myuser2@mydomain.net `
                         -removeAddress myuser3@mydomain.net, myuser4@mydomain.net
# End example

Parameters

  • -vip: Cohesity Cluster to connect to
  • -username: Cohesity username
  • -domain: (optional) Cohesity logon domain (defaults to local)
  • -addAddress: (optional) one or more email addresses to add (comma separated)
  • -removeAddress: (optional) one or more email addresses to add (comma separated)