Virtualization

Adding Memory and CPU with PowerCLI

In this article discussed about   Adding Memory and CPU with PowerCLI in VMware vSphere environment.

It is possible to increase Memory or CPU of a virtual machine only if hot plug is enabled. Without that, you have to power off the virtual machine and make the changes.

In order to use PowerCLI will take Windows PowerShell as a source.

Adding Memory and CPU with PowerCLI for a Virtual Machine:

Step1:

VMware PowerCLI is compatible minimum with Windows PowerShell 5.1 version.

let’s check PowerShell version in windows machine. Open Windows PowerShell and Run as administrator.

 

Adding Memory and CPU with PowerCLI
                                                                        Check the PowerShell Version in Windows Machine

 

Step2 :

Try to execute VMware PowerCLI modules from Windows PowerShell, as shown in below picture.

Adding Memory and CPU with PowerCLI
                                                                           Check PowerCLI modules.

 

The above error defines VMware PowerCLI Module was not installed. Since don’t have any Internet connectivity to install PowerCLI on my machine, will Install PowerCLI Offline mode.

 

Install PowerCLI modules in offline:

Step3:

Check in below mentioned location if any VMware Modules are existing.

Install all VMware PowerCLI modules in offline
                                                                               Verify VMware Modules in local disk C.

 

you can see VMware Modules are NOT existing. So download latest click VMware PowerCLI ZIP file

 

Step4:

Copy the ZIP file to your windows machine and extract the zip file and COPY all folders to below location.

 

Adding Memory and CPU with PowerCLI
                                                                                           Copy the files for local disk c as mentioned above location.

 

Step5:

Now check VMware PowerCLI Module functionality

Adding Memory and CPU with PowerCLI
                                                                                  Verify PowerCLI modules in Windows PowerShell

 

Also check PowerCLIVersion and we can ignore the certificate warning, we need to run a basic configuration command so that we are not prompted to join VMware’s Customer Experience Improvement Program.

you can also use Set-PowerCLIConfiguration -Scope AllUsers -ParticipateInCeip $false -InvalidCertificateAction Ignore

 

Set the participation to false and ignore invalid certificates for all users
                          Set the participation to false and ignore invalid certificates for all users

 

Using PowerCLI Connect to VMware vCenter Server:

Step6:

In order to increase virtual CPU and virtual memory connect to vCenter Server by using Connect-VIserver IPaddress or hostname and Provide username and password

Adding Memory and CPU with PowerCLI
                                               Connect to vCenter server using vSphere credentials.

 

Enable Hot Plug for CPU and Memory:

VM called TEST which we are going to increase CPU. Firstly, check TEST machine Status and current CPU Count.

Enable Hot Plug for CPU and Memory
                                                                             VM is in Powered ON state.

 

Before going to increase the CPUs count its mandatory to enable Hot Plug. In fact, by default hot plug was not enabled in VMware vSphere environment for CPU and MEMORY.

In order to enable Hot Plug for CPU or MEMORY to a virtual machine it must be in POWEROFF STATE. As you see above picture TEST machine is in Powered On state, let’s power OFF and enable Hot Plug for CPU and MEMORY.

 

Adding Memory and CPU with PowerCLI
                                                                         Status of HOT PLUGIN

 

Above screenshot describes hot plugin status for CPU and MEMORY it was FALSE (disable state). To Enable, we must the Power OFF the VM (TEST).

Now Enable Hot Plugin for CPU and MEMORY and check status of hot add, it is TRUE (enable state).

 

Enable Hot Plugin
                                                             Enable hot add for CPU and MEMORY

 

Increase Memory and CPU:

Step7: Since we enabled Hot Plugins, now increase CPU and MEMORY to TEST virtual machine.

Increase vCPU and vMemory
                                                          CPU count increased to 6 and Memory count to 10.

 

NOTE: To Enable or Disable Hot Plugin VM Must be in powered OFF state.

 

conclusion:

Adding Memory and CPU with PowerCLI has been completed successfully. I hope you will find this PowerCLI script useful and will find the output with the list of Virtual machines that have hot add memory & hot plug CPU status helpful.

Thanks for your time, leave a comment if you have any queries about Adding Memory and CPU with PowerCLI.

As VMware advanced concept written NSX-V and NSX-T differences.

Next PostUpgrade CentOS 6 to CentOS 7 Previous PostHow to set GRUB2 password

Leave a Reply

Your email address will not be published. Required fields are marked *