VMware Cloud Community
ganapa2000
Hot Shot
Hot Shot
Jump to solution

Unable to validate VM, Hot CPU and Memory Add

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"}

 

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

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

0 Kudos
ganapa2000
Hot Shot
Hot Shot
Jump to solution

Perfect. Thank you very much 🙂

0 Kudos