Skip to main content

Is that any way to trigger notification when backup job start?

Just to add, pre-job script is definitely the way to go. You can pull information on the job invoking the script with:

 

$ScriptPID = Get-WMIObject win32_process | Where-Object {$_.ProcessID -eq $PID}
$ParentProc = Get-WMIObject win32_process | Where-Object {$_.ProcessID -eq $ScriptPID.ParentProcessId}
$JobID = $ParentProc.CommandLine.Split())7].Trim('"')
$Job = Get-VBRJob | Where-Object {$_.id -eq $JobID}

Then in PS just pass relevant properties from $Job to your script to send information on it.


What about setting the PowerShell script to send email like this:

 

 

This is the PowerSHell script content which can be customized for your use:

# In the next line, paste the results from this command: Read-Host -Prompt 'Password' -AsSecureString | ConvertFrom-SecureString | Set-Clipboard
$EncryptedCredential = "<See comment above>"
$EmailUsername = "email1@email.com"
$EncryptedPW = $EncryptedCredential | ConvertTo-SecureString
$Credential = New-Object System.Management.Automation.PsCredential($EmailUsername, $EncryptedPW)
$EmailFrom = "email1@email.com"
$EmailTo = "email2@email.com"
$SMTPServer = "smtp.office365.com"
$SMTPPort = 587
$subject = "Subject email goes here"
$MessageBody = "Email body goes here"

$SMTPSsl = $true

$param = @{
    SmtpServer = $SMTPServer
    Port       = $SMTPPort
    UseSsl     = $SMTPSsl
    Credential = $Credential
    From       = $EmailFrom
    To         = $EmailTo
    Subject    = $subject
    Body       = $MessageBody
}

Send-MailMessage @param

Hope that helps.

Great suggestion!


No worries @Chris.Childerhose glad that I can share something useful to the community here 😃


What about setting the PowerShell script to send email like this:

 

 

This is the PowerSHell script content which can be customized for your use:

# In the next line, paste the results from this command: Read-Host -Prompt 'Password' -AsSecureString | ConvertFrom-SecureString | Set-Clipboard
$EncryptedCredential = "<See comment above>"
$EmailUsername = "email1@email.com"
$EncryptedPW = $EncryptedCredential | ConvertTo-SecureString
$Credential = New-Object System.Management.Automation.PsCredential($EmailUsername, $EncryptedPW)
$EmailFrom = "email1@email.com"
$EmailTo = "email2@email.com"
$SMTPServer = "smtp.office365.com"
$SMTPPort = 587
$subject = "Subject email goes here"
$MessageBody = "Email body goes here"

$SMTPSsl = $true

$param = @{
    SmtpServer = $SMTPServer
    Port       = $SMTPPort
    UseSsl     = $SMTPSsl
    Credential = $Credential
    From       = $EmailFrom
    To         = $EmailTo
    Subject    = $subject
    Body       = $MessageBody
}

Send-MailMessage @param

Hope that helps.

Actually forgot about this. Good suggestion 👍


What about setting the PowerShell script to send email like this:

 

 

This is the PowerSHell script content which can be customized for your use:

# In the next line, paste the results from this command: Read-Host -Prompt 'Password' -AsSecureString | ConvertFrom-SecureString | Set-Clipboard
$EncryptedCredential = "<See comment above>"
$EmailUsername = "email1@email.com"
$EncryptedPW = $EncryptedCredential | ConvertTo-SecureString
$Credential = New-Object System.Management.Automation.PsCredential($EmailUsername, $EncryptedPW)
$EmailFrom = "email1@email.com"
$EmailTo = "email2@email.com"
$SMTPServer = "smtp.office365.com"
$SMTPPort = 587
$subject = "Subject email goes here"
$MessageBody = "Email body goes here"

$SMTPSsl = $true

$param = @{
    SmtpServer = $SMTPServer
    Port       = $SMTPPort
    UseSsl     = $SMTPSsl
    Credential = $Credential
    From       = $EmailFrom
    To         = $EmailTo
    Subject    = $subject
    Body       = $MessageBody
}

Send-MailMessage @param

Hope that helps.


Typically it is for job completion but maybe VONE can do that.  Will need to check.


Comment