Unable to retrieve physical size of available storage for cluster

后端 未结 2 1222
青春惊慌失措
青春惊慌失措 2021-01-25 04:51

I am half way down with my work and now stuck.

I am trying to fetch information about available storage devices for a cluster. I am able to fetch the list of available s

2条回答
  •  礼貌的吻别
    2021-01-25 05:50

    you can use wmi like this:

    Get-WMIObject Win32_LogicalDisk -filter "DriveType=3" | Select DeviceID, FreeSpace
    

    throw in a computername parameter if you wish to do it remotely

    HTH, Matt

    PS. for a more readable report you can try this:

    Get-WMIObject Win32_LogicalDisk -filter "DriveType=3" | 
      Select DeviceID, @{Name = "Free Space (%)" ; Expression= {[int] ($_.FreeSpace / $_.Size* 100)}},@{Name = "Free Space (GB)"; Expression = {[int]($_.Freespace / 1GB)}}, @{Name = "Size (GB)"; Expression = {[int]($_.Freespace / 1GB)}}
    

提交回复
热议问题