Microsoft Virtualization Discussions
Microsoft Virtualization Discussions
Hi,
my customer wants to use powershell toolkit to set a volume comment.
On CLI:
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 10.68.94.111 none
convert_ucode 10.68.94.111 on
create_ucode 10.68.94.111 on
effective_guarantee 10.68.94.111 none
extent 10.68.94.111 off
fractional_reserve 10.68.94.111 0
fs_size_fixed 10.68.94.111 off
guarantee 10.68.94.111 none
ignore_inconsistent 10.68.94.111 off
max_write_alloc_blocks 10.68.94.111 0
maxdirsize 10.68.94.111 190054
minra 10.68.94.111 off
no_atime_update 10.68.94.111 off
no_i2p 10.68.94.111 off
nosnap 10.68.94.111 on
nosnapdir 10.68.94.111 off
nvfail 10.68.94.111 off
read_realloc 10.68.94.111 off
root 10.68.94.111 false
schedsnapname 10.68.94.111 create_time
snapmirrored 10.68.94.111 off
snapshot_clone_dependency 10.68.94.111 off
try_first 10.68.94.111 volume_grow
The same for set,
How i can realize this?
Best wishes,
Markus.
Solved! See The Solution
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 : 10.61.172.155
SuccessCount : 2
FailureCount : 0
SuccessList : {vol1, vol2}
FailureList : {}
Can you try using
Invoke-NcSsh
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 : 10.61.172.155
SuccessCount : 2
FailureCount : 0
SuccessList : {vol1, vol2}
FailureList : {}