Subscribe
Accepted Solution

AutoSize

Hi guys,

I would like to get the values of Autosize (maximum and increments) for all the volumes in the filer

I've tried 'Get-NaVol | Get-NaVolAutosize' but it gives no names of the volumes

any ideas?

Cheers

Re: AutoSize

You're looking for something like this

$autosize = get-navolautosize $name -ea "silentlycontinue"

$unit = 1gb

If ($autosize.isEnabled) {

  [System.Math]::Floor($autosize.maximumsize/$unit)

[System.Math]::Floor($autosize.incrementsize/$unit)

}

You can start with that in your loop, I use that for an excel output so it's a little different, but those are the properties you need

So in your case

$vols = Get-navol

$vols | % {

$volume = $_

$autosize = get-navolautosize $name -ea "silentlycontinue"

$unit = 1gb

If ($autosize.isEnabled) {

$max =  [System.Math]::Floor($autosize.maximumsize/$unit)

$inc =  [System.Math]::Floor($autosize.incrementsize/$unit)

write-host "Autosize:  enabled " & "maximum size: "  $max & "increment size: " $inc

}

Give that a shot, I didn't test it

Re: AutoSize

results:

===================

Ampersand not allowed. The & operator is reserved for future use; use "&" to pass ampersand as a string.

At C:\autosize.ps1:9 char:35

+ write-host "Autosize:  enabled " & <<<<  "maximum size: "  $max & "increment size: " $inc

    + CategoryInfo          : ParserError: (Smiley Happy [], ParseException

    + FullyQualifiedErrorId : AmpersandNotAllowed

==================

thank you

Re: AutoSize

I've changed it to this:

===================

$vols = Get-navol

$vols | % {

$volume = $_

$autosize = get-navolautosize $name -ea "silentlycontinue"

$unit = 1gb

If ($autosize.isEnabled) {

$max =  [System.Math]::Floor($autosize.maximumsize/$unit)

$inc =  [System.Math]::Floor($autosize.incrementsize/$unit)}

write-host "Autosize:  enabled "

write-host "maximum size: "  $max

write-host "increment size: " $inc

===================

but now I am getting this:

Get-NaVolAutosize : Cannot bind argument to parameter 'Name' because it is null.

At C:\autosize.ps1:4 char:30

+ $autosize = get-navolautosize <<<<  $name -ea "silentlycontinue"

    + CategoryInfo          : InvalidData&colon; (Smiley Happy [Get-NaVolAutosize], ParameterBindingValidationException

    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,DataONTAP.PowerShell.SDK.Cmdlets.Volume.G

   etNaVolAutosize

Autosize:  enabled

maximum size:

increment size:

Re: AutoSize

change $name to $volume

But we should do this the right way with custom objects

$global=@()

$vols = Get-navol

$vols | % {

$volume = $_

$autosize = get-navolautosize $volume -ea "silentlycontinue"

$unit = 1gb

If ($autosize.isEnabled) {

$customobject = new-object psobject

     add-member -inputobject $customobject -membertype noteproperty -name Volume -value $volume

     add-member -inputobject $customobject -membertype noteproperty -name Autosize -value "enabled"

  add-member -inputobject $customobject -membertype noteproperty -name Max -value [System.Math]::Floor($autosize.maximumsize/$unit)

  add-member -inputobject $customobject -membertype noteproperty -name increment -value [System.Math]::Floor($autosize.incrementsize/$unit)}

$global += $customobject

}

$global | ft -autosize

###

Try that

Re: AutoSize

results:

===========================

Add-Member : The SecondValue parameter is not necessary for a member of type "NoteProperty" and should not be specified

. Do not specify the SecondValue parameter when adding members of this type.

At C:\autosize2.ps1:13 char:13

+   add-member <<<<  -inputobject $customobject -membertype noteproperty -name increment -value [System.Math]::Floor($a

utosize.incrementsize/$unit)}

    + CategoryInfo          : InvalidOperation: (Smiley Happy [Add-Member], InvalidOperationException

    + FullyQualifiedErrorId : Value2ShouldNotBeSpecified,Microsoft.PowerShell.Commands.AddMemberCommand

Re: AutoSize

Ah, when you write things quick in notepad this happens...  Ok, give this a whilr

$global=@()
[Int64]$Unit=1GB

$vols = Get-navol

$vols | % {

$volume = $_

$autosize = get-navolautosize $volume -ea "silentlycontinue"

If ($autosize.isEnabled) {


$customobject = new-object psobject
     add-member -inputobject $customobject -membertype noteproperty -name Volume -value $volume
     add-member -inputobject $customobject -membertype noteproperty -name Autosize -value "enabled"
     add-member -inputobject $customobject -membertype noteproperty -name Max -value ([System.Math]::Floor($autosize.maximumsize/$unit))
     add-member -inputobject $customobject -membertype noteproperty -name increment -value ([System.Math]::Floor($autosize.incrementsize/$unit))


$global += $customobject


}

}
$global | ft -autosize

and then you can dump it to excel

$global | export-csv c:\temp\autosize.csv -notypeinformation

Re: AutoSize

....like a charm!!

thank you

now you just need to explain the 'Floor' command please

Re: AutoSize

Floor is just round down to next whole number.. You can play with the formatting, but you should be more interested in the custom objects.  You can export and import them.. Much easier for scripting

Re: AutoSize

OK, you have my attention

so custom objects are basically properties that we have added to the 'get-navolautosize' cmdlet - what you would normally see with the get-member command, correct?