Ask The Experts

Highlighted

Need a help with powershell script

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
Highlighted

Re: Need a help with powershell script

Here you go:

 

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

Re: Need a help with powershell script

Gold star for you @donny_lang 

 

Highlighted

Re: Need a help with powershell script

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
    } 
 } 

 

Highlighted

Re: Need a help with powershell script

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
   } 
}
Check out the KB!
Knowledge Base
All Community Forums