Set volume autosize threshold percentage
When you modify a volume, these are 2 settings you can't modify in the default command. So here is a custom command to do it.Download DAR
For the nerds among us :), here is the code
param ( [parameter(Mandatory=$true, HelpMessage="Cluster IP address")] [string]$Cluster, [parameter(Mandatory=$true, HelpMessage="Volume name")] [string]$VolumeName, [parameter(Mandatory=$true, HelpMessage="Storage Virtual Machine name")] [string]$VserverName, [validateRange(50,99)] [parameter(Mandatory=$false, HelpMessage="The threshold percentage when autogrow must be triggered")] [int]$GrowThresholdPercent, [validateRange(30,95)] [parameter(Mandatory=$false, HelpMessage="The threshold percentage when autoshrink must be triggered")] [int]$ShrinkThresholdPercent ) # connect to controller Connect-WfaCluster $Cluster #testing volume existence. this command somehow doesn't throw exception if # ErrorAction is 'Stop' and the volume isn't found. adding if block $vol = Get-NcVol -Name $VolumeName -Vserver $VserverName if(!$vol) { throw "Volume '$VolumeName' not found on Storage Virtual Machine '$VserverName'" } if (!$GrowThresholdPercent -and !$ShrinkThresholdPercent) { throw "At least one of the volume attributes that can be modified by this command must be provided." } if($ShrinkThresholdPercent) { $vol | Set-NcVolAutoSize -ShrinkThresholdPercent $ShrinkThresholdPercent -ErrorAction Stop } if($GrowThresholdPercent) { $vol | Set-NcVolAutoSize -GrowThresholdPercent $GrowThresholdPercent -ErrorAction Stop }
No comments :
Post a Comment