<?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 Using update commands with queried objects in Software Development Kit (SDK) and API Discussions</title>
    <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/Using-update-commands-with-queried-objects/m-p/96519#M1263</link>
    <description>&lt;P&gt;It appears as if I have to do a lot of extra steps in order to use update commands with the powershell sdk. &amp;nbsp;For example, this is the detailed example for update-ncvol:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;C:\PS&amp;gt;$q = Get-NcVol -Template
Initialize-NcObjectProperty $q VolumeIdAttributes
$q.VolumeIdAttributes.Name = "vol1|vol2"
$q.VolumeIdAttributes.OwningVserverName = "vserver1"
$a = Get-NcVol -Template
Initialize-NcObjectProperty $a VolumeIdAttributes
$a.VolumeIdAttributes.Comment = "Database volumes"
Update-NcVol -Query $q -Attributes $a&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and it works when I try it out. &amp;nbsp;I am trying to gather and then update a set of volumes from a cluster by doing this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;$volumes = Get-NcVol

foreach ($vol in $volumes){
&amp;nbsp; &amp;nbsp; $replaceWith = Get-NcVol -Template
&amp;nbsp; &amp;nbsp; Initialize-NcObjectProperty $replaceWith VolumeIdAttributes&amp;nbsp;
&amp;nbsp; &amp;nbsp; $replaceWith.VolumeIdAttributes.Comment = "test comment"

&amp;nbsp; &amp;nbsp; Update-NcVol -Query $vol -Attributes $replaceWith
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But it doesn't work. &amp;nbsp;Apparently I have no choice but to move information from the volumes I retrieved from the cluster to empty volumes in order to make it work?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;For instance, this works:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;$volumes = Get-NcVol

foreach ($vol in $volumes){
&amp;nbsp; &amp;nbsp;$query&amp;nbsp;= Get-NcVol -Template
&amp;nbsp; &amp;nbsp; Initialize-NcObjectProperty $query&amp;nbsp;VolumeIdAttributes
&amp;nbsp; &amp;nbsp; $query.Name = $vol.Name
&amp;nbsp; &amp;nbsp; $query.Vserver = $vol.Vserver
&amp;nbsp;
&amp;nbsp; &amp;nbsp; $replaceWith = Get-NcVol -Template
&amp;nbsp; &amp;nbsp; Initialize-NcObjectProperty $replaceWith VolumeIdAttributes&amp;nbsp;
&amp;nbsp; &amp;nbsp; $replaceWith.VolumeIdAttributes.Comment = "test comment"
&amp;nbsp;
&amp;nbsp; &amp;nbsp; Update-NcVol -Query $query -Attributes $replaceWith
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it necessary to do all these extra steps? &amp;nbsp;Wouldn't it make more sense if I could just use the queried vol object for the update command? &amp;nbsp;Please let me know if there's a better way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 05 Jun 2025 05:24:46 GMT</pubDate>
    <dc:creator>DerekC</dc:creator>
    <dc:date>2025-06-05T05:24:46Z</dc:date>
    <item>
      <title>Using update commands with queried objects</title>
      <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/Using-update-commands-with-queried-objects/m-p/96519#M1263</link>
      <description>&lt;P&gt;It appears as if I have to do a lot of extra steps in order to use update commands with the powershell sdk. &amp;nbsp;For example, this is the detailed example for update-ncvol:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;C:\PS&amp;gt;$q = Get-NcVol -Template
Initialize-NcObjectProperty $q VolumeIdAttributes
$q.VolumeIdAttributes.Name = "vol1|vol2"
$q.VolumeIdAttributes.OwningVserverName = "vserver1"
$a = Get-NcVol -Template
Initialize-NcObjectProperty $a VolumeIdAttributes
$a.VolumeIdAttributes.Comment = "Database volumes"
Update-NcVol -Query $q -Attributes $a&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and it works when I try it out. &amp;nbsp;I am trying to gather and then update a set of volumes from a cluster by doing this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;$volumes = Get-NcVol

foreach ($vol in $volumes){
&amp;nbsp; &amp;nbsp; $replaceWith = Get-NcVol -Template
&amp;nbsp; &amp;nbsp; Initialize-NcObjectProperty $replaceWith VolumeIdAttributes&amp;nbsp;
&amp;nbsp; &amp;nbsp; $replaceWith.VolumeIdAttributes.Comment = "test comment"

&amp;nbsp; &amp;nbsp; Update-NcVol -Query $vol -Attributes $replaceWith
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But it doesn't work. &amp;nbsp;Apparently I have no choice but to move information from the volumes I retrieved from the cluster to empty volumes in order to make it work?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;For instance, this works:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;$volumes = Get-NcVol

foreach ($vol in $volumes){
&amp;nbsp; &amp;nbsp;$query&amp;nbsp;= Get-NcVol -Template
&amp;nbsp; &amp;nbsp; Initialize-NcObjectProperty $query&amp;nbsp;VolumeIdAttributes
&amp;nbsp; &amp;nbsp; $query.Name = $vol.Name
&amp;nbsp; &amp;nbsp; $query.Vserver = $vol.Vserver
&amp;nbsp;
&amp;nbsp; &amp;nbsp; $replaceWith = Get-NcVol -Template
&amp;nbsp; &amp;nbsp; Initialize-NcObjectProperty $replaceWith VolumeIdAttributes&amp;nbsp;
&amp;nbsp; &amp;nbsp; $replaceWith.VolumeIdAttributes.Comment = "test comment"
&amp;nbsp;
&amp;nbsp; &amp;nbsp; Update-NcVol -Query $query -Attributes $replaceWith
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it necessary to do all these extra steps? &amp;nbsp;Wouldn't it make more sense if I could just use the queried vol object for the update command? &amp;nbsp;Please let me know if there's a better way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jun 2025 05:24:46 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/Using-update-commands-with-queried-objects/m-p/96519#M1263</guid>
      <dc:creator>DerekC</dc:creator>
      <dc:date>2025-06-05T05:24:46Z</dc:date>
    </item>
  </channel>
</rss>

