Skip to content

Instantly share code, notes, and snippets.

@nshores
Last active July 16, 2019 00:15
Show Gist options
  • Save nshores/5c0e0f2a302f656db6f94d5f388aa5b9 to your computer and use it in GitHub Desktop.
Save nshores/5c0e0f2a302f656db6f94d5f388aa5b9 to your computer and use it in GitHub Desktop.
Rubrik SLA Report
#Rubrik SLA Report
# Possible Frequencies - $@{daily=; weekly=; monthly=; yearly=}
$server = '10.1.204.50'
$username = 'admin'
$password = ''
connect-rubrik -server $server -Username $username -Password $password
#Capture all the SLA's into a custom object
$sla = Get-RubrikSLA
#Create our empty array, and hash table for future usage
$sla_report_array = @()
$slaRecord = @{
"Name" = ''
"Daily Freq" = ''
"Daily Retention" = ''
"Weekly Freq" = ''
"Weekly Retention" = ''
"Monthly Freq" = ''
"Monthly Retention" = ''
"Objects" = ''
}
#For each SLA Object, loop through them and extract the information we want
foreach ($s in $sla){
$slaRecord."Name" = $s.name
$slaRecord."Objects" = $s.numProtectedObjects
#TODO - Create archive policy loop
if ($s.frequencies.daily)
{
$slaRecord."Daily Freq" = $s.frequencies.daily.frequency
$slaRecord."Daily Retention" = $s.frequencies.daily.retention
}
if ($s.frequencies.weekly)
{
$slaRecord."Weekly Freq" = $s.frequencies.weekly.frequency
$slaRecord."Weekly Retention" = $s.frequencies.weekly.retention
}
if ($s.frequencies.monthly)
{
$slaRecord."Monthly Freq"= $s.frequencies.monthly.frequency
$slaRecord."Monthly Retention" = $s.frequencies.monthly.retention
}
$slaOBjRecord = New-Object PSObject -property $slaRecord
$sla_report_array +=$slaOBjRecord
}
$sla_report_array | Export-Csv "SLA_Report.csv" -NoTypeInformation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment