Hi,
I would like to validate the CPU output, the below works, if the output value is equals to zero,
Please help, how can I validate and exit if output of variables is zero and negative.
$TotalCPU = 100
$UsedCPU = 150
$cpu = $TotalCPU - $UsedCPU
if (($cpu) -eq 0) {
"Validation Failed"
return
}
else {
"Validation Success"
}
You mean like this?
Change -eq into -le
$UsedCPU = 150
$cpu = $TotalCPU - $UsedCPU
if (($cpu) -le 0) {
"Validation Failed"
return
}
else {
"Validation Success"
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You mean like this?
Change -eq into -le
$UsedCPU = 150
$cpu = $TotalCPU - $UsedCPU
if (($cpu) -le 0) {
"Validation Failed"
return
}
else {
"Validation Success"
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you much, that worked perfect