Src/Private/Report/Get-AbrVbrStorageOntap.ps1
|
function Get-AbrVbrStorageOntap { <# .SYNOPSIS Used by As Built Report to retrieve NetApp Ontap Storage Information .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES Version: 1.0.0 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux Credits: Iain Brighton (@iainbrighton) - PScribo module .LINK https://github.com/AsBuiltReport/AsBuiltReport.Veeam.VBR #> [CmdletBinding()] param ( ) begin { Write-PScriboMessage "Discovering NetApp Ontap Storage information connected to $System." $LocalizedData = $reportTranslate.GetAbrVbrStorageOntap Show-AbrDebugExecutionTime -Start -TitleMessage 'NetApp Ontap Storage' } process { if ($OntapHosts = Get-NetAppHost) { Section -Style Heading3 $LocalizedData.Heading { Paragraph $LocalizedData.Paragraph BlankLine $OutObj = @() try { foreach ($OntapHost in $OntapHosts) { Section -Style Heading4 $($OntapHost.Name) { try { $UsedCred = Get-VBRCredentials | Where-Object { $_.Id -eq $OntapHost.Info.CredsId } $OntapOptions = [xml]$OntapHost.info.Options $inObj = [ordered] @{ $LocalizedData.DNSName = switch (($OntapHost.Info.HostInstanceId).count) { 0 { $OntapHost.Info.DnsName } default { $OntapHost.Info.HostInstanceId } } $LocalizedData.Description = $OntapHost.Description $LocalizedData.StorageType = $OntapHost.NaOptions.HostType $LocalizedData.UsedCredential = switch (($UsedCred).count) { 0 { '--' } default { "$($UsedCred.Name) - ($($UsedCred.Description))" } } $LocalizedData.ConnectionAddress = $OntapHost.ConnPoints -join ', ' $LocalizedData.ConnectionPort = "$($OntapOptions.NaHostOptions.NaHostOptions.NaHostConnectionOptions.Port)\TCP" $LocalizedData.InstalledLicenses = $OntapHost.NaOptions.License } $OutObj = [pscustomobject](ConvertTo-HashToYN $inObj) $TableParams = @{ Name = "$($LocalizedData.NetAppHostTableHeading) - $($OntapHost.Name)" List = $true ColumnWidths = 40, 60 } if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams if ($InfoLevel.Storage.Ontap -ge 2) { try { $OntapVols = Get-NetAppVolume -Host $OntapHost if ($OntapVols) { Section -Style NOTOCHeading5 -ExcludeFromTOC $LocalizedData.VolumesSubHeading { $OutObj = @() foreach ($OntapVol in $OntapVols) { try { $inObj = [ordered] @{ $LocalizedData.Name = $OntapVol.Name $LocalizedData.TotalSpace = ConvertTo-FileSizeString -RoundUnits $Options.RoundUnits -Size $OntapVol.Size $LocalizedData.UsedSpace = ConvertTo-FileSizeString -RoundUnits $Options.RoundUnits -Size $OntapVol.ConsumedSpace $LocalizedData.ThinProvision = $OntapVol.IsThinProvision } $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning "NetApp Ontap Storage $($OntapVol.Name) Volumes Section: $($_.Exception.Message)" } } $TableParams = @{ Name = "$($LocalizedData.NetAppVolumesTableHeading) - $($OntapHost.Name)" List = $false ColumnWidths = 52, 15, 15, 18 } if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Sort-Object -Property $LocalizedData.Name | Table @TableParams } } } catch { Write-PScriboMessage -IsWarning "NetApp Ontap Storage Volumes Section: $($_.Exception.Message)" } } } catch { Write-PScriboMessage -IsWarning "NetApp Ontap Storage Section: $($_.Exception.Message)" } } } } catch { Write-PScriboMessage -IsWarning "NetApp Ontap Section: $($_.Exception.Message)" } } } } end { Show-AbrDebugExecutionTime -End -TitleMessage 'NetApp Ontap Storage' } } |