Hi,
Below script excludes one particular datastore from the output, but how can I exclude multiple datastores from the below script,
please help
Get-Cluster MyClus | Get-Datastore | Sort-Object -Property {$_.FreeSpaceGB} -Descending:$true | where {$_.Name -ne "datastore1"} | Select-Object -ExpandProperty Name -First 1
You could use the -notcontains operator.
Get-Cluster MyClus |
Get-Datastore |
Sort-Object -Property {$_.FreeSpaceGB} -Descending:$true |
where {$excludeNames -notcontains $_.Name} |
Select-Object -ExpandProperty Name -First 1
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You could use the -notcontains operator.
Get-Cluster MyClus |
Get-Datastore |
Sort-Object -Property {$_.FreeSpaceGB} -Descending:$true |
where {$excludeNames -notcontains $_.Name} |
Select-Object -ExpandProperty Name -First 1
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you very much