Checking Disk Usage
Here's a function I have in my profile, I use it to do a quick disk usage check on servers:
Function Get-Disk { Param($computer) $disks = gwmi -computername $computer Win32_LogicalDisk -Filter 'DriveType = 3' $disks | %{ New-Object PSObject -Property @{ Drive=$_.DeviceID; Capacity="{0:n} GB" -f ($_.Size / 1GB); Used="{0:n} GB" -f ($_.FreeSpace / 1GB); } } }
Here's an example of running this function:
[PS:8] Get-Disk server01 Drive Used Capacity ----- ---- -------- C: 4.58 GB 68.25 GB E: 64.18 GB 598.40 GB F: 238.62 GB 598.40 GB










