Reply to Message

View discussion in a popup

Replying to:
LucD
Leadership
Leadership

You could do something like this.

Note: with the -contains operator you can only check against full name, no masking characters.

If you want to check for part of a name (like local*), you coan use a RegEx expression.

Note that in a RegEx expression the vertical bar is the OR. So in the example the datastorename shall not contain 'local' or 'otherundesired'.

$undesiredDatastores = "local|otherundersired"

$report=Get-Datastore |

Select Name,

    @{N='UsedPerc';E={($_.CapacityGB - $_.FreeSpaceGB)/$_.CapacityGB}} |

where{$_.UsedPerc -ge 0.9 -and $_.Name -notmatch $undesiredDatastores} |

Select Name |

Sort-Object -Property Name


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos