Skip to content

Instantly share code, notes, and snippets.

@Xainey
Created February 23, 2017 19:50
Show Gist options
  • Save Xainey/699c4fa5790f0eedc57571adf1dfc84f to your computer and use it in GitHub Desktop.
Save Xainey/699c4fa5790f0eedc57571adf1dfc84f to your computer and use it in GitHub Desktop.
Quick and dirty view
function space($pc)
{
Get-WmiObject Win32_LogicalDisk -ComputerName $pc |
Where-Object {$_.DriveType -eq 3} |
Select-Object DeviceID, VolumeName, `
@{n="Size"; e={[math]::round($_.Size / 1GB, 1)}}, `
@{n="FreeSpace"; e={[math]::round($_.FreeSpace / 1GB, 1)}}, `
@{n="PercentFree"; e={[math]::round($_.FreeSpace / $_.Size * 100.0, 1)}} |
Format-Table
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment