Hi,
I am trying to validate, if the VM exists in a particular folder and has CPU and Memory HotAdd enabled. But I am able unable to validate as there is not error.
Please help
$serv="myvm1"
get-folder 'MyFolder' | get-vm | Get-View | Where-Object {$_.name -eq $serv -and ($_.name).config.CpuHotAddEnabled -eq "True" -and ($_.name).config.MemoryHotAddEnabled -eq "True"}
You mean something like this?
$serv="myvm1"
if(Get-Folder -Name 'MyFolder' | Get-VM | where{
$_.Name -eq $serv -and $_.ExtensionData.Config.CpuHotAddEnabled -and $_.ExtensionData.Config.MemoryHotAddEnabled}){
Write-host "VM found"
}
else{
Write-host "VM not found"
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You mean something like this?
$serv="myvm1"
if(Get-Folder -Name 'MyFolder' | Get-VM | where{
$_.Name -eq $serv -and $_.ExtensionData.Config.CpuHotAddEnabled -and $_.ExtensionData.Config.MemoryHotAddEnabled}){
Write-host "VM found"
}
else{
Write-host "VM not found"
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Perfect. Thank you very much 🙂