PowerShell script exchange
Post Reply
cmorice
Novice
Posts: 4
Liked: 1 time
Joined: Oct 09, 2014 9:50 am
Full Name: Christophe MORICE
Contact:

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

Post by cmorice »

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
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

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

Post by veremin »

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.
cmorice
Novice
Posts: 4
Liked: 1 time
Joined: Oct 09, 2014 9:50 am
Full Name: Christophe MORICE
Contact:

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

Post by cmorice »

It's working fine.

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

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

Post by veremin »

You're welcome. Feel free to ask for additional help, if any is needed. Thanks.
larry
Veteran
Posts: 387
Liked: 97 times
Joined: Mar 24, 2010 5:47 pm
Full Name: Larry Walker
Contact:

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

Post by larry » 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.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

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

Post by veremin »

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.
cmorice
Novice
Posts: 4
Liked: 1 time
Joined: Oct 09, 2014 9:50 am
Full Name: Christophe MORICE
Contact:

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

Post by cmorice » 1 person likes this post

I'd added the TapeInventory task before your update.
Thanks
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

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

Post by veremin »

Like it, it's always good to be proactive. Especially in case of automating, where only the sky is the limit for your creativity. :)
Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests