Automation

 View Only
  • 1.  Error enabling CPU hotadd and Mem hotplug

    Posted Oct 28, 2021 01:33 PM

    I am trying to enable CPU and Mem hotplug on a newly deployed VM and I am getting the following error. It's powered off

    PS C:\WINDOWS\system32> $VM="DEV999-test"
    PS C:\WINDOWS\system32> $spec = New-Object VMware.Vim.VirtualMachineConfigSpec
    $spec.CpuHotAddEnabled = $true
    $spec.MemoryHotAddEnabled = $true
    $VM.ExtensionData.ReconfigVM($spec)

    You cannot call a method on a null-valued expression.
    At line:4 char:1
    + $VM.ExtensionData.ReconfigVM($spec)
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    PS C:\WINDOWS\system32>
    PS C:\WINDOWS\system32>
    PS C:\WINDOWS\system32>
    PS C:\WINDOWS\system32>
    PS C:\WINDOWS\system32> Get-PowerCLIVersion
    WARNING: The cmdlet "Get-PowerCLIVersion" is deprecated. Please use the 'Get-Module' cmdlet instead.

    PowerCLI Version
    ----------------
    VMware PowerCLI 12.2.0 build 17538434
    ---------------
    Component Versions
    ---------------
    VMware Common PowerCLI Component 12.3 build 17838947
    VMware Cis Core PowerCLI Component PowerCLI Component 12.3 build 17839331
    VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 12.3 build 17839688

     

    What am I doing wrong ?

    Thks
    Gaetan



  • 2.  RE: Error enabling CPU hotadd and Mem hotplug
    Best Answer

    Posted Oct 28, 2021 01:37 PM

    You can't use the OBN feature when calling vSphere API.
    Change the 1st command to

     

    $VM = Get-VM -Name "DEV999-test"

     



  • 3.  RE: Error enabling CPU hotadd and Mem hotplug

    Posted Oct 28, 2021 02:05 PM

    LucD, you are a star !!