<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: script to addup volume used and available size in Software Development Kit (SDK) and API Discussions</title>
    <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/script-to-addup-volume-used-and-available-size/m-p/448338#M3278</link>
    <description>&lt;P&gt;Perhaps convert everything to bytes first then total and convert back to whichever unit you want?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;function Convert-UnitsToBytes {
    [cmdletbinding()]
    param (
        [Parameter(Mandatory = $True)]
        [uint64]$Size,
        [Parameter(Mandatory = $True)]
	    [ValidateSet('MB', 'GB', 'TB')]$Unit
    )

    # Converts BYTES to a specified UNIT (MB|GB|TB)
    #   - Any other Unit will return the original value passed in

    $Unit = $Unit.ToUpper()

    switch ($Unit) {
        'MB' {
            $bytes = $size * 1MB
        }
        'GB' {
            $bytes = $size * 1GB
        }
        'TB' {
            $bytes = $size * 1TB
        }
        Default {
            $bytes = $size
        }
    }

    return $bytes

}&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 20 Oct 2023 20:01:30 GMT</pubDate>
    <dc:creator>JohnChampion</dc:creator>
    <dc:date>2023-10-20T20:01:30Z</dc:date>
    <item>
      <title>script to addup volume used and available size</title>
      <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/script-to-addup-volume-used-and-available-size/m-p/448300#M3277</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attempting to create a script which will add up the total available and used size of all volume&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is my script&amp;nbsp;&lt;/P&gt;&lt;P&gt;$vols = Get-NcVol&lt;BR /&gt;$voltotal = $vols | Measure-Object -Property TotalSize -Sum&lt;BR /&gt;$voltotalsize = ConvertTo-FormattedNumber $voltotal.sum DataSize -Verbose&lt;BR /&gt;$volused = $vols | Measure-Object -Property Used -Sum&lt;BR /&gt;$volusedsize = ConvertTo-FormattedNumber $volused.sum DataSize -Verbose&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is giving me wrong numbers I think this is because the get-ncvol give&amp;nbsp; volume size in Gb,Tb and Mb so we basically can not add apple to orange&amp;nbsp;&lt;/P&gt;&lt;P&gt;Has anyone everdone that ? can you give me an exemple ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2023 21:43:35 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/script-to-addup-volume-used-and-available-size/m-p/448300#M3277</guid>
      <dc:creator>sakalava</dc:creator>
      <dc:date>2023-10-19T21:43:35Z</dc:date>
    </item>
    <item>
      <title>Re: script to addup volume used and available size</title>
      <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/script-to-addup-volume-used-and-available-size/m-p/448338#M3278</link>
      <description>&lt;P&gt;Perhaps convert everything to bytes first then total and convert back to whichever unit you want?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;function Convert-UnitsToBytes {
    [cmdletbinding()]
    param (
        [Parameter(Mandatory = $True)]
        [uint64]$Size,
        [Parameter(Mandatory = $True)]
	    [ValidateSet('MB', 'GB', 'TB')]$Unit
    )

    # Converts BYTES to a specified UNIT (MB|GB|TB)
    #   - Any other Unit will return the original value passed in

    $Unit = $Unit.ToUpper()

    switch ($Unit) {
        'MB' {
            $bytes = $size * 1MB
        }
        'GB' {
            $bytes = $size * 1GB
        }
        'TB' {
            $bytes = $size * 1TB
        }
        Default {
            $bytes = $size
        }
    }

    return $bytes

}&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 20 Oct 2023 20:01:30 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/script-to-addup-volume-used-and-available-size/m-p/448338#M3278</guid>
      <dc:creator>JohnChampion</dc:creator>
      <dc:date>2023-10-20T20:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: script to addup volume used and available size</title>
      <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/script-to-addup-volume-used-and-available-size/m-p/448347#M3279</link>
      <description>&lt;P&gt;thanks a lot&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I think I found an alternative&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Get-NcVol | ForEach-Object {&lt;BR /&gt;$x = "" | Select Name,Total_TB,Available_TB&lt;BR /&gt;$x.Name = $_.Name&lt;BR /&gt;$x.Total_TB = [Math]::Round($_.TotalSize / 1TB, 2)&lt;BR /&gt;$x.Available_TB = [Math]::Round($_.Available / 1TB, 2)&lt;BR /&gt;$x | Format-Table -AutoSize | Out-String | ForEach-Object { $_.Trim("`r","`n") }&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2023 07:42:34 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/script-to-addup-volume-used-and-available-size/m-p/448347#M3279</guid>
      <dc:creator>sakalava</dc:creator>
      <dc:date>2023-10-23T07:42:34Z</dc:date>
    </item>
  </channel>
</rss>

