Check Hyper-V CSV Volumes FreeSpace


################################################
# Name: CheckStorageHV
# Desc: Displays CSV Volumes FreeSpace.
# Date: 24/01/2013
# Auth: Alberto Ruiz
###############################################

$Result=@()

$Volumes= Get-VMHost | Get-VmHostVolume | ? {$_.Name -match "ClusterStorage"}
Cls
Write-Host "I'm thinking ... "
Foreach ($Volumen in $Volumes)
{
$Dato=“” | Select HostName,StorageName,FreeSpace
$HostNameFixed = $Volumen.VMHost
$HostNameFixed = ("$HostNameFixed").ToUpper()
$Dato.Hostname = $HostNameFixed
$Dato.StorageName = $Volumen.name.replace("C:\ClusterStorage\","")
$Dato.FreeSpace = [math]::round(($Volumen.FreeSpace / $Volumen.Capacity)*100,2)
$Result += $Dato

}

$Result | Sort-Object FreeSpace | Out-Gridview

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s