Windows 10: Any Powershell Guru's out there?

  1.    09 Dec 2017 #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 ComputerSystem Spec


  2. Posts : 591
    Windows 10 Pro 64bit
       10 Dec 2017 #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 ComputerSystem Spec

  3.    10 Dec 2017 #3

    Bastet said: View Post
    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 ComputerSystem Spec


 

Related Threads
I gotta be honest here, I found a tutorial - but it was "juuuust" beyond my grasp and when working with the registry it can get hairy. Spent a lot of time getting this pc set up and dont want to lose it all due to my OCD desire to "customize" this...
BIG problems Win 10 Guru needed (Please) in Installation and Upgrade
Hi everyone why is it that you only get 'problems' when playing with someone else's PC/Laptop !!!!!!:( Have just upgraded friends laptop - W7 to W10. Installation went well (as per many already done). This was done via a USB flashdrive. HOWEVER...
Hi folks, Here is a challenge for the Drivers and Hardware Guru's on the Forum!! I have an old (USB Gen 1) keyboard which is (was back in the day) a very capable device with many additional useful pre/programmable buttons for a host of media,...
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 10:30.
Find Us