PowerShell script exchange
Post Reply
neil.hsieh
Novice
Posts: 4
Liked: never
Joined: Sep 16, 2015 2:19 pm
Full Name: Neil
Contact:

Email Notifications after Task

Post by neil.hsieh »

Hi All,

I have an automated Powershell script just about done that will allow us to switch between 2 NAS drives on the Veeam server (one enable, other disable, and vice versa) on a quarterly basis.

Now I am stuck at the point where we would like email notifications whenever this switch happens so we can know which drives successfully Enabled and/or Disabled.
I am looking for a Powershell script so I can just append that to the script I have now.

I have tried the following but to no success: http://helpcenter.veeam.com/backup/80/p ... tions.html

Any help would be greatly appreciated.

Thanks.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Email Notifications after Task

Post by veremin »

You should probably stick to ordinary Windows PowerShell, not VB&R snap-in. Are those drives added under different letters or maybe have some distinguishing factor that can be seen via Windows PowerShell?
neil.hsieh
Novice
Posts: 4
Liked: never
Joined: Sep 16, 2015 2:19 pm
Full Name: Neil
Contact:

Re: Email Notifications after Task

Post by neil.hsieh »

The drives exist under different servers and we just import them through Veeam. How would this procedure wok with Windows PowerShell?
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Email Notifications after Task

Post by veremin »

Can you elaborate on "import through Veeam" portion? Are they added as different repositories to a backup console? Thanks.
neil.hsieh
Novice
Posts: 4
Liked: never
Joined: Sep 16, 2015 2:19 pm
Full Name: Neil
Contact:

Re: Email Notifications after Task

Post by neil.hsieh »

It is added through Backup Infrastructure -> Mangaed Servers and is added as a Windows Server. I believe after adding through here, its is automatically updated in the Backup Repositories.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Email Notifications after Task

Post by veremin »

Servers added to managed servers don't automatically get assigned repository role. So, your deployment and your overall goal are still unclear to me. Thanks.
neil.hsieh
Novice
Posts: 4
Liked: never
Joined: Sep 16, 2015 2:19 pm
Full Name: Neil
Contact:

Re: Email Notifications after Task

Post by neil.hsieh »

Sorry if I've not been too clear on answering the questions you have for me because I am still getting acquainted with Veeam as I've only been assigned to work on this recently.

As far as I know, I've only had to add in 1 server, and that was through Backup Infrastructure -> Managed Servers -> Microsoft Windows -> (right click) Add Server, and I am adding in our NAS drives with its DNS name which exist in our domain which in which our Veeam server exists in as well.

Going back to your comment about using Powershell and not the Veeam Snap-ins, is there a pre defined function in Powershell to send email notifications after a certain task is completed? If so can you show me how this is done?

Thanks.
weiyentan
Lurker
Posts: 1
Liked: never
Joined: May 24, 2014 8:47 am
Full Name: Wei-Yen Tan
Contact:

Re: Email Notifications after Task

Post by weiyentan »

Good example on how to write the email notification in standard Microsoft Powershell is here:

http://www.adminarsenal.com/admin-arsen ... il-example

and here:

http://blogs.msdn.com/b/rkramesh/archiv ... cript.aspx
Dima P.
Product Manager
Posts: 14396
Liked: 1568 times
Joined: Feb 04, 2013 2:07 pm
Full Name: Dmitry Popov
Location: Prague
Contact:

Re: Email Notifications after Task

Post by Dima P. »

Hi folks,

Some Veeam Endpoint Backup users has already written a really great examples. Feel free to adjust and test some proposed scripts from this thread
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Email Notifications after Task

Post by veremin »

Is there a pre defined function in Powershell to send email notifications after a certain task is completed?
Sure you can send an email after a certain task. In order to do that either use Send-MailMessage if you're on PowerShell 4.0 or higher or leverage New-Object Net.Mail.SmtpClient() if you're on older versions.

However, it's still not what a certain task. Is that drive rotation on the said NAS device or something different?

Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests