Any Powershell Guru's out there?


  1. Posts : 70
    Windows 10 Pro
       #1

    Any Powershell Guru's out there?


    Having trouble with a backup script for Veeam which is supposed to backup all my VM's and then email a report.
    After a bit of tweaking the script works as far as the backup goes and backs up all the VM's to my Synology NAS.

    Trouble I am having is that it will not send the email report. The last bit of the script looks like this

    Code:
    {
    $Message = New-Object System.Net.Mail.MailMessage $EmailFrom, $EmailTo
    $Message.Subject = $EmailSubject
    $Message.IsBodyHTML = $True
    $message.Body = $MesssagyBody | ConvertTo-Html -head $style | Out-String
    $SMTP = New-Object Net.Mail.SmtpClient($SMTPServer)
    $SMTP.Send($Message)
    }
    If I run this in the PowerShell ISE windowed interface all it does is output the above to the console and does not send the email.
    Do I just remove the curly brackets? I would have thought it should have run with the curly brackets anyway.
    This is not a script I wrote but one I have adapted to my system but the bottom part said not to change things past a certain point.

    Thanks.
      My Computer


  2. Posts : 2,234
    Windows 11 Pro 64bit
       #2

    Until someone more qualified in using powershell scripts posts, my thoughts would be that you need to enter the details like from email address, to address, email subject, smtp server details & message contents/body rather than what’s written.
      My Computer


  3. Posts : 70
    Windows 10 Pro
    Thread Starter
       #3

    Bastet said:
    Until someone more qualified in using powershell scripts posts, my thoughts would be that you need to enter the details like from email address, to address, email subject, smtp server details & message contents/body rather than what’s written.
    That is all there above this part. The Subject, To, and From address are all stored in variables. The message itself is built up as each VM is backed up and says where it succeeded or failed.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 01:55.
Find Us




Windows 10 Forums