
UNSOLVED
DB
DELL-Bill Gr
50 Posts
0
5739
November 21st, 2011 11:00
Powershell - Script to verify RMS replay status
This post has been copied from the former Compellent User Forum and placed here for your reference. This code is made available AS IS, without warranty of any kind. The entire risk of the use or the results from the use of this code remains with the user.
Script to verify RMS replay status – Originally posted By Dan.Marbes, 02 Dec 2010
Dan.Marbes - I have been looking for ways to make sure I don't have any RMS 5.x installs that are hung up. If you're not aware, the job scheduler will fail if it gets backed up by more than 5 jobs (in my experience due to funky stuff happening when expiring replays). At any rate, the script below will loop through a list of Storage Centers, find any volumes with have application-generated replays, and then find the most current replay for that volume. Since all of the times that are returned with Get-SCReplay (CreateTime, FreezeTime, etc) are strings, I've used the ParseExact to convert those strings into DateTime objects for comparison. When complete, it emails the output. This is an early revision of this code, but hopefully is at least somewhat useful.
$format = "MM/dd/yyyy hh:mm:ss tt"
$SANList = ('SAN1','SAN2') #enter Storage Center names here
$provider = [System.Globalization.CultureInfo]::InvariantCulture
$date = get-date
$emailtext = "Runtime: $date"
foreach($array in $SANList)
{
$emailtext = $emailtext + "`n" + $array
#Get array of all replays created by RMS on the array
$volreplays = Get-SCReplay -ConnectionName $Array -createsource application -state frozen
if($volreplays.count -gt 0) #If there are RMS replays, continue
{
#Get list of volume indices with RMS replays
$RMSVols = New-Object System.Collections.ArrayList
foreach($replay in $volreplays)
{
$volindex = $replay.SourceVolumeIndex
if($RMSVols -contains $volindex)
{
#do nothing
}
else
{
[void]$RMSVols.add($volindex) #build array of RMS volumes
}
}
foreach($volume in $RMSVols)
{
# for each volume, reset the newest date to an arbitrary value
$NewestReplay = get-date 1/1/2010
$VolName = Get-SCVolume -ConnectionName $Array -index $volume
$emailtext = $emailtext + "`n" + $volname.name
foreach($replay in $volreplays)
{
if($replay.sourcevolumeindex -eq $volume)
{
#this is the conversion of the string to a datetime
$CT = [DateTime]::ParseExact($replay.freezetime, $format, $provider)
if($ct -gt $newestreplay)
{
$newestreplay = $ct
}
}
}
$emailtext = $emailtext + "`n" + "Most recent replay taken at: $newestreplay" + "`n"
if($newestreplay -lt ((get-date).adddays(-1)))
{
$emailtext = $emailtext + "`n" + "***Most recent replay older than 24 hours, may indicate an issue" + "`n"
}
}
}
}
Send-MailMessage -to -subject "RMS replay checks" `
-smtpserver -from `
-body $emailtext
Responses (0)
Solutions (0)
