Tag: disk space

  • Powershell – To check the Drive and Disk Space Information

    To get the disk space details of the server, simply go to command prompt and paste the below script it will give you disk space details.

    powershell -command "& {Get-WmiObject -Class Win32_LogicalDisk -Filter 'DriveType = 3' |select PSComputerName, Caption,@{N='Capacity_GB'; E={[math]::Round(($_.Size / 1GB), 2)}},@{N='FreeSpace_GB'; E={[math]::Round(($_.FreeSpace / 1GB), 2)}},@{N='PercentUsed'; E={[math]::Round(((($_.Size - $_.FreeSpace) / $_.Size) * 100), 2) }},@{N='PercentFree'; E={[math]::Round((($_.FreeSpace / $_.Size) * 100), 2) }}}"
    

    Sample Output
    Caption : C:
    Capacity_GB : 283.44
    FreeSpace_GB : 51.48
    PercentUsed : 81.84
    PercentFree : 18.16

  • Powershell Script to get total and free disk space

    You can execute the below powershell script to get total & free disk space which includes the mount drive as well.

    Get-WmiObject -class Win32_volume -filter "drivetype = 3" | select name,
     @{Name="Capacity";Expression={$_.capacity / 1GB}},@{Name="freespace";Expression
    ={$_.freespace / 1GB}}