Src/Private/Get-AbrWinHostStorageVolume.ps1
function Get-AbrWinHostStorageVolume { <# .SYNOPSIS Used by As Built Report to retrieve Windows Server Host Storage Volume information. .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES Version: 0.5.6 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport Github: AsBuiltReport Credits: Iain Brighton (@iainbrighton) - PScribo module .LINK https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows #> [CmdletBinding()] param ( ) begin { Write-PScriboMessage "Storage InfoLevel set at $($InfoLevel.Storage)." Write-PScriboMessage "Collecting Host Storage Volume information." } process { if ($InfoLevel.Storage -ge 1) { try { $HostVolumes = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-Volume | Where-Object { $_.DriveType -ne "CD-ROM" -and $_.DriveLetter } } if ($HostVolumes) { Section -Style Heading3 'Host Volumes' { Paragraph 'The following section details local volumes on the host' BlankLine $OutObj = @() ForEach ($HostVolume in $HostVolumes) { try { $inObj = [ordered] @{ 'Drive Letter' = $HostVolume.DriveLetter 'File System Label' = $HostVolume.FileSystemLabel 'File System' = $HostVolume.FileSystem 'Size' = "$([Math]::Round($HostVolume.Size / 1gb)) GB" 'Free Space' = "$([Math]::Round($HostVolume.SizeRemaining / 1gb)) GB" 'Health Status' = $HostVolume.HealthStatus } $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ Name = "Host Volumes" List = $false ColumnWidths = 15, 15, 15, 20, 20, 15 } if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Sort-Object -Property 'Drive Letter' | Table @TableParams } } } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } } } end {} } |