NetApp Community Update
This site will enter Read Only mode on July 23 as we prepare to move to a new platform. You will still be able to view content, but posting and replying will be temporarily disabled.
We're excited to launch our new Community experience on July 30 and more information will follow soon.
Stay connected during the transition - Join our Discord community today.

Software Development Kit (SDK) and API Discussions

volume "Tags" property always empty with Powershell cmdlet "get-ncvol"

yala37
1,532 Views

Hello Everyone,

 

I'm trying to get my volume tags set via System Manager with the simple powershell cmdlet "get-ncVol", but "Tags" property is always empty.

 

I've also try the cmdlet with "-zapiCall" parameter, but having the same empty result. 

 

powershell SDK 9.15.1.2407

powershell 5.1

Windows 2019

Ontap 9.14.1P8

 

thanks in advance.

 

Yala

 

 

1 REPLY 1

mattglg
620 Views

Im getting the same issue as this with version 9.18.1.2601 of the PS module, I ended up having to use a api call to grab the tags.

function  Get-ONTAPVolTags {
    param (
        [Parameter(Mandatory,
            ValueFromPipeline)] 
        [string]$clusterName,
        [Parameter(Mandatory)] 
        [string]$volUUID,
        [Parameter()]
        [ValidateNotNull()]
        [System.Management.Automation.PSCredential]
        [System.Management.Automation.Credential()]
		$creds = [System.Management.Automation.PSCredential]::Empty
    )
    process {

    $apiquery = "https://$clusterName/api/storage/volumes/$($volUUID)?fields=uuid%2Cname%2C_tags&return_timeout=120"

    # Send the API request to get volume information
    $result = Invoke-RestMethod -Method GET -Uri $apiquery -Credential $creds
    # Return
    $result._tags -replace(':','=') |ConvertFrom-StringData 
        
    }#END PROCESS
}#END FUNCTION

###############
Public