Eine kleine Funktion „GetSANPath“, um die Cluster Shared Volumes inkl. ein paar Infos in einem Grid View auszugeben und auszuwählen.
Die PowerShell Funktion GetSANPath liest alle gemounteten Cluster Shared Volumes aus und holt sich Informationen zu Größe und freiem sowie genutztem Speicherplatz. Die Informationen werden dann ein wenig sortiert und in einem Grid View ausgegeben. Das ausgewählte CSV wird anschließend in eine Variable geschrieben, auf die gewünschten Infos „Name“ und „Pfad“ gekürzt und zurückgegeben.
GetSANPath Grid View GetSANPath Ausgabe
Den größten bzw. wichtigsten Teil des Scriptes habe ich im Script Center des Technets gefunden: https://gallery.technet.microsoft.com/scriptcenter/Monitor-Cluster-Shared-21de7554
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | function GetSANPath { $Output = @() $csvs = Get-ClusterSharedVolume foreach ( $csv in $csvs ) { $csvinfos = $csv | select -Property Name -ExpandProperty SharedVolumeInfo foreach ( $csvinfo in $csvinfos ) { $temp_csv = New-Object PSObject -Property @{ Name = $csv .Name Size = $( [math] ::round((( $csvinfo .Partition.Size) / 1GB), 2)) FreeSpace = $( [math] ::round((( $csvinfo .Partition.FreeSpace) / 1GB), 2)) UsedSpace = $( [math] ::round((( $csvinfo .Partition.UsedSpace) / 1GB), 2)) PercentFree = $csvinfo .Partition.PercentFree Path = $csvinfo .FriendlyVolumeName } $Output += $temp_csv } } do { $SAN = $Output | Select-Object Name, @{l= "Größe in GB" ; e={ $_ .Size}}, @{l= "Freier Speicher in GB" ; e={ $_ .FreeSpace}}, @{l= "Benutzter Speicher in GB" ; e={ $_ .UsedSpace}}, @{l= "Freier Speicher in %" ; e={ $_ .PercentFree}}, @{l= "Pfad" ; e={ $_ .Path}} | Out-GridView -PassThru } until ( $SAN ) $SAN = @{ Name = $SAN .Name Path = $SAN .Pfad } return $SAN } |
Schreibe einen Kommentar