Wednesday 31 August 2022

Calculate drive space using powershell

Following command use to calculate drive available space 

 Get-WmiObject -Class Win32_logicaldisk -Filter "DriveType = '3'" | 

Select-Object -Property DeviceID, DriveType, VolumeName, 

@{L='AvailableSpace';E={"{0:N2}" -f ($_.FreeSpace /1GB)}},

@{L="TotalDiskSize";E={"{0:N2}" -f ($_.Size/1GB)}}