Microsoft Virtualization Discussions

Snapshots report

seffysefix
3,281 Views

Hi,

We would like to set an alert/Email that generates if no new snapshot is created using powerhsell.

Basically, we  want to know if a volume has no snapshots in the last x days, so let's say vol1 has no shopshots in the last 24 hours, we would like to receive and email.

Can anyone please help?

Thanks!

2 REPLIES 2

olson
3,281 Views

How about something like this:

$vols = (get-ncvol W2K12SMB3*)|select -expandproperty name

foreach ($v in $vols){

if((get-ncsnapshot $v|?{$_.Created -gt (get-date).AddDays(-1)}).count){

    write-host "volume $v has current snapshots"

    }

}

The Parameters can be tweaked like days or sub na for nc for Legacy.

seffysefix
3,281 Views

Hi,

Thanks for the reply.

what I want to achieve via powershell is to have a script run once a day and scan all volumes, then if a volume has no snap shots for more than 1 day, receive an alert.

Thanks

Public