You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
600 B
PowerShell

# Check Free Space Script
$servers = @($hostname) # Replace $hostname with the computer's hostname
Foreach ($server in $servers)
{
$disks = Get-WmiObject Win32_LogicalDisk -ComputerName $server -Filter DriveType=3 |
Select-Object DeviceID,
@{'Name'='Size'; 'Expression'={[math]::truncate($_.size / 1GB)}},
@{'Name'='Freespace'; 'Expression'={[math]::truncate($_.freespace / 1GB)}}
$server
foreach ($disk in $disks)
{
$disk.DeviceID + $disk.FreeSpace.ToString("N0") + "GB / " + $disk.Size.ToString("N0") + "GB"
}
}