Sending an email if standalone tape drive is empty at 4pm...

PowerShell script exchange

Sending an email if standalone tape drive is empty at 4pm...

Veeam Logoby cmorice » Sat Jan 14, 2017 10:53 pm

Hi,
I want to send an email to the backup operator at 4pm if my standalone LTO7 drive is empty.

I know how to send an email with Powershell but I do not figure out how to use the Get-VBRTapeDrive command to send the message only if drive is empty.

Can you help me ?

chm
cmorice
Novice
 
Posts: 4
Liked: 1 time
Joined: Thu Oct 09, 2014 9:50 am
Full Name: Christophe MORICE

Re: Sending an email if standalone tape drive is empty at 4p

Veeam Logoby v.Eremin » Mon Jan 16, 2017 10:28 am

Something like this should meet your expectations:

Code: Select all
Asnp VeeamPssnapin
Get-VBRTapeLibrary | Start-VBRTapeInventory -Wait
if ((Get-VBRTapeDrive -name "Name of your tape drive").state -eq "Empty")
{}
Else {}


Thanks.
v.Eremin
Veeam Software
 
Posts: 13702
Liked: 1020 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Sending an email if standalone tape drive is empty at 4p

Veeam Logoby cmorice » Tue Jan 17, 2017 10:09 pm

It's working fine.

Thanks a lot !
cmorice
Novice
 
Posts: 4
Liked: 1 time
Joined: Thu Oct 09, 2014 9:50 am
Full Name: Christophe MORICE

Re: Sending an email if standalone tape drive is empty at 4p

Veeam Logoby v.Eremin » Wed Jan 18, 2017 11:49 am

You're welcome. Feel free to ask for additional help, if any is needed. Thanks.
v.Eremin
Veeam Software
 
Posts: 13702
Liked: 1020 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Sending an email if standalone tape drive is empty at 4p

Veeam Logoby larry » Fri Jan 27, 2017 7:13 pm 1 person likes this post

You need to add line
Get-VBRTapeLibrary | Start-VBRTapeInventory -Wait

to update that a tape got put in.

I liked the idea so we did it as well. Just found if someone cleaned or push the eject button veeam didn't know until we did inventory.
larry
Expert
 
Posts: 383
Liked: 90 times
Joined: Wed Mar 24, 2010 5:47 pm
Full Name: Larry Walker

Re: Sending an email if standalone tape drive is empty at 4p

Veeam Logoby v.Eremin » Tue Jan 31, 2017 11:46 am

Correct, if a drive in the idle state, you need to inventory it to update its status. Thank you for your feedback, I've already updated the original script.
v.Eremin
Veeam Software
 
Posts: 13702
Liked: 1020 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Sending an email if standalone tape drive is empty at 4p

Veeam Logoby cmorice » Mon Feb 06, 2017 10:14 am 1 person likes this post

I'd added the TapeInventory task before your update.
Thanks
cmorice
Novice
 
Posts: 4
Liked: 1 time
Joined: Thu Oct 09, 2014 9:50 am
Full Name: Christophe MORICE

Re: Sending an email if standalone tape drive is empty at 4p

Veeam Logoby v.Eremin » Mon Feb 06, 2017 11:50 am

Like it, it's always good to be proactive. Especially in case of automating, where only the sky is the limit for your creativity. :)
v.Eremin
Veeam Software
 
Posts: 13702
Liked: 1020 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 1 guest