Reply to Message

View discussion in a popup

Replying to:
ganapa2000
Hot Shot
Hot Shot

Unable to get free space of VM

Hi,

I am unable to get free space of VM level. Please help

function get-mysummary() {

  param(

   [VMware.VimAutomation.ViCore.Types.V1.Inventory.Folder]$Folder,

   [switch]$Recursion

  )

  $report = @()

  $vms = Get-VM -Location $Folder -NoRecursion:(-not $Recursion)

  if($vms.Count -gt 0){

   $report += Get-VM -Location $Folder -NoRecursion:(-not $Recursion) |

  Select Folder, Name,

   @{N = "IP Address"; E = {@($_.guest.IPAddress[0])}},

   @{N="VM PowerState";E={@($_.PowerState)}},

   @{N="OS"; E={@($_.guest.OSFullName)}},

   @{N = "CPU"; E = {@($_.NumCPU)}},

   @{N = "Memory (GB)"; E = {@($_.MemoryGB)}},

   @{N = "Provisioned (GB)"; E = {[math]::Round($_.provisionedspacegb)}}

   @{N="FreeSpace(GB)";E={[math]::Round($_.FreeSpace / 1GB)}},

   @{N="FreeSpace(%)";E={[math]::Round(((100* ($_.FreeSpace))/($_.Capacity)),0)}},

   @{N="UsedSpace(GB)";E={[math]::Round(((($_.Capacity / 1GB))-($_.FreeSpace / 1GB)),0)}})

}

The above command shows blank for Freespace

Reply
0 Kudos