$Disk = "C:"
$FreeDiskSpace = get-WmiObject win32_logicaldisk -ComputerName $Env:ComputerName -Filter "DeviceID='$Disk'" | ForEach-Object {[math]::Round($_.freespace / 1GB, 1)}
if ($FreeDiskSpace -gt 20)
{[System.Windows.MessageBox]::Show("space is available")}
Else
{[System.Windows.MessageBox]::Show("space is not available")}
Comments