Good morning All!
I have a script to run a daily backup. It is scheduled on the scheduler and is meant to generate an email upon completion. I know the syntax is correct because when I run it in debug mode the email gets generated properly. I feel like it might be a permissions issue and have tried with different credentials.
Perhaps, I haven’t used the right combination of creds – I’m only human…but what I would really like is the ability to get some logging that will tell me what the issue/error is.
Here is a snippet of the code:
if ($bkerror -eq $null)
$summary = get-wbsummary
[string] $emailline1 = “Last backup Time: ” + [string]$summary.LastSuccessfulBackupTime
[string] $emailline2 = “Last backup destination: ” + [string]$summary.LastSuccessfulBackupTargetPath
[string] $emailline3 = “Last backup drives: ” + [string]$Volume
[string]$emailbody = $emailline1 + $emailline2 + $emailline3
$scriptname = $myinvocation.mycommand
$emailsubj = $computer + ” ” + $scriptname + ” ” + $dayofweek
You must be logged in to reply to this topic.
Create a free account today to participate in forum conversations, comment on posts and more.