Skip to content

Instantly share code, notes, and snippets.

View KentaGoto's full-sized avatar
🍧
🚀🚀🚀🚀🚀

KentaGoto

🍧
🚀🚀🚀🚀🚀
  • Tokyo, Japan
  • 09:57 (UTC +09:00)
View GitHub Profile
# ドライブの使用状況を取得する
$diskUsage = Get-WmiObject Win32_LogicalDisk | Where-Object { $_.DriveType -eq 3 } | ForEach-Object {
[PSCustomObject]@{
'Drive' = $_.DeviceID
'UsedSpaceGB' = [math]::Round((($_.Size - $_.FreeSpace) / 1GB), 2)
'FreeSpaceGB' = [math]::Round(($_.FreeSpace / 1GB), 2)
'TotalSpaceGB' = [math]::Round(($_.Size / 1GB), 2)
}
}