De vrije ruimte van een CSV kun je met het powershell commando get-clustersharedvolume bekijken.
Dit is echter een nested object en kan worden weergegeven met de format-custom attribute:
De vrije ruimte zit in nested object SharedVolumeInfo\Partition en wordt in bytes weergegeven.
Met onderstaand script kun je een overzicht van de CSVs krijgen:
Get-ClusterSharedVolume | select -Expand SharedVolumeInfo | select -Expand Partition | ft -auto Name,@{ Label = "Size(GB)" ; Expression = { "{0:N2}" -f ($_.Size/1024/1024/1024) } },@{ Label = "FreeSpace(GB)" ; Expression = { "{0:N2}" -f ($_.FreeSpace/1024/1024/1024) } },@{ Label= "UsedSpace(GB)" ; Expression = { "{0:N2}" -f ($_.UsedSpace/1024/1024/1024) } },@{ Label = "PercentFree" ; Expression = { "{0:N2}" -f ($_.PercentFree) } }
Met onderstaand script worden de Volume namen omgezet in FriendlyVolumeName.
Import-Module FailoverClusters
$objs = @()
$csvs = Get-ClusterSharedVolume
foreach ( $csv in $csvs )
{
$csvinfos = $csv | select -Property Name -ExpandProperty SharedVolumeInfo
foreach ( $csvinfo in $csvinfos )
{
$obj = New-Object PSObject -Property @{
Name = $csv.Name
Path = $csvinfo.FriendlyVolumeName
Size = $csvinfo.Partition.Size
FreeSpace = $csvinfo.Partition.FreeSpace
UsedSpace = $csvinfo.Partition.UsedSpace
PercentFree = $csvinfo.Partition.PercentFree
}
$objs += $obj
}
}
$objs | ft -auto Name,Path,@{ Label = "Size(GB)" ; Expression = { "{0:N2}" -f ($_.Size/1024/1024/1024) } },@{ Label = "FreeSpace(GB)" ; Expression = { "{0:N2}" -f ($_.FreeSpace/1024/1024/1024) } },@{ Label = "UsedSpace(GB)" ; Expression = { "{0:N2}" -f ($_.UsedSpace/1024/1024/1024) } },@{ Label = "PercentFree" ; Expression = { "{0:N2}" -f ($_.PercentFree) } }
Natuurlijk willen we dit op afstand kunnen uitvoeren, hiervoor moet Powershell remoting enabled worden:
How to enable Powershell remoting:
Run Enable-PSRemoting, this will perform serveral tasks:
- Start (or restart, if it’s already started) the WinRM service.
- Set the WinRM service to start automatically from now on.
- Create a WinRM listener for HTTP traffic on port 5985 for all local IP addresses.
- Create a Windows Firewall exception for the WinRM listener. Note that this will fail on client versions of Windows if any network cards are configured to have a type of “Public,” because the firewall will refuse to create new exceptions on those cards. If this happens, change the network card’s type to something else (like “Work” or “Private,” as appropriate), and run Enable-PSRemoting again. Alternately, if you know you have some Public network cards, add the –SkipNetworkProfileCheck parameter to Enable-PSRemoting. Doing so will successfully create a firewall exception that allows incoming Remoting traffic only from the computer’s local subnet.
Geen opmerkingen:
Een reactie posten