7 months ago
POWERSHELL 커맨드로 각 디스크 사용량 확인방법
ㅁ POWERSHELL 커맨드로 각 디스크 사용량 확인방법
> Get-WmiObject Win32_LogicalDisk | Select-Object DeviceID, @{Name="Size(GB)";Expression={[math]::Round($_.Size / 1GB, 2)}}, @{Name="FreeSpace(GB)";Expression={[math]::Round($_.FreeSpace / 1GB, 2)}}, @{Name="UsedSpace(GB)";Expression={[math]::Round(($_.Size - $_.FreeSpace) / 1GB, 2)}}
ㅁ C와 D만 추출하는 커맨드
> Get-WmiObject Win32_LogicalDisk | Where-Object { $_.DeviceID -eq 'C:' -or $_.DeviceID -eq 'D:' } | Select-Object DeviceID, @{Name="Size(GB)";Expression={[math]::Round($_.Size / 1GB, 2)}}, @{Name="FreeSpace(GB)";Expression={[math]::Round($_.FreeSpace / 1GB, 2)}}, @{Name="UsedSpace(GB)";Expression={[math]::Round(($_.Size - $_.FreeSpace) / 1GB, 2)}}