Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Drive Statistics Lister
- # Lists Drives and Space Info [Letter, Drive Name, Free (GBs), Size (GBs)]
- # Version: 1.0A
- # Displays a "Drive Stats:" Message
- Write-Host
- Write-Host 'Drive Stats:' -ForegroundColor Yellow
- # Gets the drive information (excluding 0 MB drives)
- $driveInformation = Get-WmiObject win32_logicaldisk | Where-Object {$_.Size -gt 0}
- # Displays the data in a formatted table
- $driveInformation | Format-Table @{Expression={$_.DeviceId};Label='Letter'},
- @{Expression={$_.VolumeName};Label='Name'},
- @{n='Free (GBs)';e={[math]::Round($_.FreeSpace/1GB,2)}},
- @{n='Size (GBs)';e={[math]::Round($_.Size/1GB,2)}}
Advertisement
Add Comment
Please, Sign In to add comment