pick up a random datastore by condition (#2057)

This commit is contained in:
Aleksandr Chebotov
2020-11-13 18:00:58 +03:00
committed by GitHub
parent 1be42bd050
commit 9ef75097cf

View File

@@ -61,7 +61,7 @@ function Select-DataStore {
$buildDatastore = $allDatastores | Where-Object { $_.FreeSpaceGB -ge $thresholdInGb } | Where-Object {
$vmOnDatastore = @((Get-ChildItem -Path $_.DatastoreBrowserPath).Name -notmatch "^\.").Count
$vmOnDatastore -lt $vmCount
} | Select-Object -ExpandProperty Name -First 1
} | Get-Random | Select-Object -ExpandProperty Name
$tag = Get-Tag -Category $TagCategory -Name $VMName -ErrorAction Ignore
if (-not $tag)