Help with 'op_Division'.

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of random commandline random commandline 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #37217
    Profile photo of Marcia Matsuo
    Marcia Matsuo
    Participant

    I am a beginner...
    Here is what I am trying to accomplish:
    $id=get-ntnxcluster
    $TotalTb=$id.usageStats.'storage.capacity_bytes'[0]
    [int]$Total=$TotalTb/1tb
    $AvailableTb=$id.usageStats.'storage.free_bytes'[0]
    [int]$Available=$AvailableTb/1tb
    $FreeTb=$id.usageStats.'storage.usage_bytes'[0]
    [int]$Free=$FreeTb/1tb
    My problem is that $TotalTb, $AvailableTb and $Freetb have 2 entries so I am only getting the first entry in $Total,$Available,$Free divided.

    Thanks,
    Marcia

    #37220
    Profile photo of random commandline
    random commandline
    Participant

    I do not have a Nutanix environment to test, but this logic should work to get disk stats.

    $id.usageStats | ForEach-Object {
    [pscustomobject]@{
            Capacity = "{0:N2}" -f ($_.'storage.capacity_bytes' / 1TB)
            Free = "{0:N2}" -f ($_.'storage.free_bytes' / 1TB)
            Usage = "{0:N2}" -f ($_.'storage.usage_bytes' / 1TB)
    }}
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.