Skip to content

Commit

Permalink
Merge pull request #17 from mwpreston/dev
Browse files Browse the repository at this point in the history
A handful of fixes addressing null checks
  • Loading branch information
tpcarman authored May 21, 2021
2 parents 5f105de + 1dbf0e7 commit e5dfe2d
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 6 deletions.
Binary file modified AsBuiltReport.Rubrik.CDM.psd1
Binary file not shown.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Rubrik CDM As Built Report Changelog

## [1.0.1]

### Added

* Added null check on SMB Domain information
* Added null check on Syslog Information
* Added null check on Guest OS Credentials Information

### Modified

* Modified null check on VMware VMs protected objects section as it was trying to index a null array

## [1.0.0] - 2021-01-29

### Added
Expand Down
28 changes: 22 additions & 6 deletions Src/Public/Invoke-AsBuiltReport.Rubrik.CDM.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function Invoke-AsBuiltReport.Rubrik.CDM {
.DESCRIPTION
Documents the configuration of the Rubrik CDM in Word/HTML/XML/Text formats using PScribo.
.NOTES
Version: 1.0.0
Version: 1.0.1
Author: Mike Preston
Twitter: @mwpreston
Github: mwpreston
Expand Down Expand Up @@ -290,15 +290,26 @@ function Invoke-AsBuiltReport.Rubrik.CDM {
@{Name = 'Force SMB Security'; Expression = { $SMBSecurityInformation.enforceSmbSecurity } }
}
Write-PScriboMessage -Message "[Rubrik] [$($brik)] [Cluster Settings] Output SMB Domains"
$SMBDomainInformation | Table -Name 'SMB Domains'
# Currently Get-RubrikSMBDomain has the possiblity of being null so we must check here
if ($null -eq $SMBDomainInformation) {
Paragraph "No SMB Domain information configured"
}
else {
$SMBDomainInformation | Table -Name 'SMB Domains'
}
}

Section -Style Heading4 'Syslog Settings' {
Write-PScriboMessage -Message "[Rubrik] [$($brik)] [Cluster Settings] Retrieving Syslog Information"
$SyslogInformation = Get-RubrikSyslogServer | Select-Object -Property @{N = "Hostname"; E = { $_.hostname } },
@{N = "Protocol"; E = { $_.protocol } }, @{N = "Port"; E = { $_.port } }
Write-PScriboMessage -Message "[Rubrik] [$($brik)] [Cluster Settings] Ouput Syslog Settings"
$SyslogInformation | Table -Name 'Syslog Settings'
if ($null -eq $SyslogInformation) {
Paragraph "No Syslog settings configured"
} else {
$SyslogInformation | Table -Name 'Syslog Settings'
}

}

Section -Style Heading4 'Security Classification Settings' {
Expand Down Expand Up @@ -363,7 +374,12 @@ function Invoke-AsBuiltReport.Rubrik.CDM {
$GuestOSCredentials = Get-RubrikGuestOsCredential | Select-Object -Property @{N = "Username"; E = { $_.username } },
@{N = "Domain"; E = { $_.domain } }
Write-PScriboMessage -Message "[Rubrik] [$($brik)] [Cluster Settings] Output Guest OS Credentials"
$GuestOSCredentials | Table -Name 'Guest OS Credentials' -ColumnWidths 50, 50
if ($null -eq $GuestOSCredentials) {
Paragraph "No Guest OS Credentials configured"
} else {
$GuestOSCredentials | Table -Name 'Guest OS Credentials' -ColumnWidths 50, 50
}

}
Section -Style Heading4 'Miscellaneous Backup Configurations' {
Write-PScriboMessage -Message "[Rubrik] [$($brik)] [Cluster Settings] Retrieving Miscellaneous Backup Settings"
Expand Down Expand Up @@ -1230,7 +1246,7 @@ function Invoke-AsBuiltReport.Rubrik.CDM {
#Applies to VMware VMs, HyperV, Nutanix, MSSQL, Oracle, VolumeGroups below
Write-PScriboMessage -Message "[Rubrik] [$($brik)] [Protected Objects] Retrieving Protected VMware VMs "
$VMwareVMs = Get-RubrikVM -Relic:$false -PrimaryClusterID 'local'
if (0 -ne $VMwareVMs[0].total) {
if ($null -ne $VMwareVMs) {
Write-PScriboMessage -Message "[Rubrik] [$($brik)] [Protected Objects] VMware VMs detected, gathering additional details "
$VMwareVMs = $VMwareVMs | Where-Object { $_.effectiveSlaDomainName -ne 'Unprotected' } | ForEach-Object { Get-RubrikVM -id $_.id | Select-Object -Property @{N = "Name"; E = { $_.name } },
@{N = "IP Address"; E = { $_.ipAddress } }, @{N = "Guest OS"; E = { $_.guestOsType } },
Expand Down Expand Up @@ -1477,4 +1493,4 @@ function Invoke-AsBuiltReport.Rubrik.CDM {

#endregion Script Body

} # End Invoke-AsBuiltReport.Rubrik.CDM function
} # End Invoke-AsBuiltReport.Rubrik.CDM function

0 comments on commit e5dfe2d

Please sign in to comment.