Ask The Experts

Need a help with powershell script

Biswarup_D
2,122 Views

I would need  a script to generate the list of volumes which have consumed more than 85% of the maximum-autosize.

Can someone help.

4 REPLIES 4

donny_lang
2,104 Views

Here you go:

 

$vols = Get-NcVol
foreach ($vol in $vols) {
    if ($vol.TotalSize -gt 0.85*$($vol.VolumeAutosizeAttributes.MaximumSize)) {
     Write-Output $vol.Name
    } 
 } 

SpindleNinja
2,101 Views

Gold star for you @donny_lang 

 

Biswarup_D
2,060 Views

Hey Donny,  Thanks a lot for the code you shared yesterday. It works fine. However i was looking for something different. I need the volumes whose consumed size is 85% of the autosize. I mean.. Used=0.85*autosize By "Used" i mean Total-available. Can you please help here. 

 


@donny_lang wrote:

Here you go:

 

$vols = Get-NcVol
foreach ($vol in $vols) {
    if ($vol.TotalSize -gt 0.85*$($vol.VolumeAutosizeAttributes.MaximumSize)) {
     Write-Output $vol.Name
    } 
 } 

 

donny_lang
2,058 Views

Oops, you're right.

 

Try this:

 

$vols = Get-NcVol
foreach ($vol in $vols) {
if ($($vol.VolumeSpaceAttributes.SizeUsed) -gt 0.85*$($vol.VolumeAutosizeAttributes.MaximumSize)) {
Write-Output $vol.Name
   } 
}
Public