Accepted Solution

Get-NcVolOption and Set-NcVolOption for vol Comment


my customer wants to use powershell toolkit to set a volume comment.


wdflab1::> vol show -vserver wdflabvs01 -volume clone_test -fields comment

  (volume show)

vserver    volume     comment

---------- ---------- -------

wdflabvs01 clone_test test

On powershell:

PS C:\Users\scheckel> Get-NcVolOption -name clone_test -VserverContext wdflabvs01

Name                                    NcController                            Value

----                                    ------------                            -----

actual_guarantee                                          none

convert_ucode                                             on

create_ucode                                              on

effective_guarantee                                       none

extent                                                    off

fractional_reserve                                        0

fs_size_fixed                                             off

guarantee                                                 none

ignore_inconsistent                                       off

max_write_alloc_blocks                                    0

maxdirsize                                                190054

minra                                                     off

no_atime_update                                           off

no_i2p                                                    off

nosnap                                                    on

nosnapdir                                                 off

nvfail                                                    off

read_realloc                                              off

root                                                      false

schedsnapname                                             create_time

snapmirrored                                              off

snapshot_clone_dependency                                 off

try_first                                                 volume_grow

The same for set,

How i can realize this?

Best wishes,


Re: Get-NcVolOption and Set-NcVolOption for vol Comment

Can you try using


Re: Get-NcVolOption and Set-NcVolOption for vol Comment

You can use the Update-NcVol cmdlet for this.  The example for that cmdlet describes this exact scenario (updating the comment field).  Or, as Vinith mentions, Invoke-NcSsh works just as well.

--------------  Example 1 --------------

C:\PS>$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

Using this cmdlet and others, execute an advanced query to set the comment field on multiple volumes.

NcController :

SuccessCount : 2

FailureCount : 0

SuccessList  : {vol1, vol2}

FailureList  : {}