当数据存储中的空闲存储空间太小时,使用PowerCLI在VMWare中创建票证

时间:2016-12-27 19:50:01

标签: vmware vsphere powercli

我可以使用以下代码将空闲空间作为ouptut。

$body +=echo "------------Free space on Datastore.--------------"`r`n""`r`n""
$body +=get-datastore -name *datastore1* | sort Name | ForEach-Object {
    $output=New-Object -TypeName PSObject -Property @{
        Freespace = "$([math]::Round($_.FreeSpaceGB, 2)) GB"
        Datastore_Name = $_.Name
        }       
    }
    Write-Output $output

如果可用空间小于2 GB,是否可以提高票证?如果是这样,我该如何更改我的代码?

1 个答案:

答案 0 :(得分:0)

编辑:

asymptotic complexity

if (get-datastore | where {$_.FreeSpaceGB -lt 2}){"dosomething"}
相关问题