Last active
July 16, 2019 00:15
-
-
Save nshores/5c0e0f2a302f656db6f94d5f388aa5b9 to your computer and use it in GitHub Desktop.
Rubrik SLA Report
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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