Manipulating VMware vSphere using PowerCLI

I enjoying using powershell so I started to explore the possibility of using it for manipulating vSphere. Low and behold, welcome to PowerCLI with similar syntax as powershell or it can be called powershell in vSphere.

Firstly, before the vCenter server can be manage, a connection is required. To do so, this command can be executed. It can also be used to connect to a single ESXi Host.

Connect-VIServer [vCenterServer or ESXiHost] -Credential(Get-Credential)

I prefer to use the Get-Credential cmdlet because it will prompt me with a windows dialog box requesting the username and password (It is a very useful cmdlet).

Once connected, to get the List of Cluster , VM or Host the following respective commands can be used:

Get-Cluster

Get-VM

Get-VMHost

To get specific details the name of the object can be added to the cmdlet. The pipe (|) can also be used to get details from specific area.

Example to retrieve all the Virtual machines within Cluster A

Get-Cluster ClusterA | Get-VM

To Get all VMs on ESXi Host A

Get-VMHost ESXiA | Get-VM

Putting an ESXi Host A in Maintenance mode

Set-VMHost ESXiA -State Maintenance

Shutting down the ESXi Host A

Stop-VMHost ESXiA-Force

Startup Virtual machine VM1 and VM2

Start-VM VM1,VM2

Exit Maintenance Mode for ESXi Host A

Set-VMHost ESXiA -State Connected

To get more cmdlet from the VMware PowerCLI, use the get-command [*keyword*] to list all commands with the keyword.

I will update this list as time progress.

Veeam Replication Job Trouble Ticket # 1

There was an email notification received from the Veeam B&R server stating that one of the VM replication job had failed with the following error:

Error: Failed to open VDDK disk [[Datastore_Name] VM_replica/VM2-000001.vmdk] ( is read-only mode – [false] ) Logon attempt with parameters [VC/ESX: [vCSA_Name];Port: 443;Login: [domain\account_name];VMX Spec: [moref=vm-40195];Snapshot mor: [snapshot-112166];Transports: [nbd];Read Only: [false]] failed because of the following errors: Failed to open disk for write. Failed to download disk. Reconnectable protocol device was closed. Failed to upload disk. Age

The first thing done was to log into the Veeam backup server and open the Veeam Backup & Replication console.   veeam_b_r_console

Under the Home, navigate to the Replicas, search for the VM. Then highlight it and right click and open the properties. It will show all the replica jobs which are snapshots on the replica VM in vSphere.

 

The two last replica job shows that they were incomplete. This sometimes indicate that there was a problem with the snapshot that was created. Logon to the vSphere web client and check the snapshot manager for the replica VM (the default naming convention is “VMName_replica“). Open the option Snapshots–>Manage Snapshots and you will expand the snapshots until you reach the last two set before “You are here”.

vsphere_snapshot

In the image, you will notice that the snapshot names “Veeam Replica Working Snapshot” which indicate that the snapshot was not completed. To eliminate the job continue failing is to delete all the snapshots with the title “Veeam Replica Working snapshot” and rerun the job from veeam so it can recreate the snapshot. If these snapshot are allowed to remain, the Veeam replica job will continue to fail.

I hope this help to resolve some of the veeam replication job failures.

VCP65-DCV – Objective 7.5 – Troubleshoot HA and DRS Configurations and Fault Tolerance

The following reference material from the vSphere 6.5 online documentation will assist you in covering the main information that is needed to know the topics in this objective:

  1. How vSphere HA works
  2. Troubleshooting vSphere HA host states
  3. Troubleshooting Availability
  4. Configure Proactive HA
  5. DRS troubleshooting information
  6. Migration with vMotion
  7. Migration with Storage vMotion
  8. Troubleshooting Storage DRS
  9. Providing Fault Tolerant for Virtual Machines
  10. Troubleshooting Fault Tolerant Virtual Machines
  11. DRS Cluster Validity
  12. Overview Performance Charts for Clusters

VCP65-DCV – Objective 8.2 – Create and Deploy Host Profiles

The following reference material from the vSphere 6.5 online documentation will assist you in covering the main information that is needed to know the topics in this objective:

  1. Using Host Profiles
  2. Disable Host Profile Component
  3. Edit Host Customizations
  4. Set Up Host Profiles for Static IP Addresses in the vSphere Web Client
  5. Configure Security Host Profiles
  6. Quickly see major enhancements Host profiles vSphere 6.5 (VMware Blogs)
  7. Remediate Host
  8. Import a Host Profile
  9. Export a Host Profile
  10. Understanding Host Profiles handles host specific configuration settings customizations (VMware Blogs)

VCP65-DCV – Objective 8.1 – Configure Auto Deploy for ESXi Hosts

The following reference material from the vSphere 6.5 online documentation will assist you in covering the main information that is needed to know the topics in this objective:

  1. Introduction to vSphere Auto Deploy
  2. PXE Booting the ESXi Installer
  3. Set up Highly Available vSphere Auto Deploy Infrastructure
  4. Troubleshooting vSphere Auto Deploy
  5. Understanding vSphere ESXi Image Builder
  6. Provisioning ESXi Systems with vSphere Auto Deploy
  7. Provision Host and Set up Host Customizations
  8. What’s new in vSphere 6.5 Auto Deploy (YouTube)

VCP-DCV – Objective 6.3 – Configure vSphere Replication

The following reference material from the vSphere 6.5 online documentation will assist you in covering the main information that is needed to know the topics in this objective:

  1. Compatibility of vSphere Replication with other vSphere features
  2. vSphere Replication Compatibility with other Software
  3. vSphere Replication TM 6.5 technical overview (storagehub.vmware.com)
  4. VMware KB 2102453 – operation limits for vsphere replication
  5. Replicating Virtual Machines
  6. How the 5 minutes Recovery Point Objective Works
  7. Performing a Recovery with vSphere Replication
  8. Change the SSL certificate for the vSphere Replication appliance
  9. Requirements when using a Public key certificate with vSphere Replication
  10. vSphere Replication Security reference

VCP65-DCV – Objective 6.2 – Configure and Administer vCenter Data Protection

The following reference material from the vSphere 6.5 online documentation will assist you in covering the main information that is needed to know the topics in this objective:

  1. vCenter Data Protection (PDF)
    • Read Chapter 1 -Understanding vSphere Data Protection
    • Chapter 2 – VDP Installation and Configuration
    • Chapter 3 – VDP Appliance Migration
    • Chapter 7 – Proxies
    • Chapter 6 – Configuring VDP
    • Chapter 8 – Storage Management
    • Chapter 12 – Managing Backups
    • Chapter 13 – Automatic Backup Verification
    • Chapter 14 – Managing Restores
    • Chapter 17 – VDP Application Support
    • Know the Appendix B – Minimum Required vCenter User Account Permissions
    • Know the Table 2.2 – Minimum system requirements for VDP
  2. Image-based backup and restore of a vCenter server environment
  3. VMware KB 2003638 – How to consolidate snapshots in vSphere 6.X/ 5.x
  4. Restore the failed vCenter server virtual machine with the Direct-to-Host

VCP65-DCV – Objective 6.1 – Configure and Administer vCenter Appliance Backup/Restore

The following reference material from the vSphere 6.5 online documentation will assist you in covering the main information that is needed to know the topics in this objective:

  1. VMware VCSA 6.5 Backup and Restore How-To (vladan.fr)
  2. Know about the SEAT (Stats, Events and Tasks) in VAMI (get familiar with the interface)
  3. Know about the VAMI – use port 5480
  4. Know the difference destination for backup – FTP, FTPS, HTTP(s) and SCP

VCP65-DCV – Objective 5.2 – Configure vSphere DRS and Storage DRS Clusters

The following reference material from the vSphere 6.5 online documentation will assist you in covering the main information that is needed to know the topics in this objective:

  1. Using VM-Host Infinity Rules
  2. vSphere 6.5 DRS Performance
  3. vSphere 6.5 DRS What’s new part 1
  4. vSphere 6.5 DRS What’s new part 2 – Predictive DRS
  5. vSphere 6.5 DRS What’s new part 3 – Proactive HA
  6. Restore a Resource Pool Tree

VCP65-DCV – Objective 5.1 –Configure Multilevel Resource Pools

The following reference material from the vSphere 6.5 online documentation will assist you in covering the main information that is needed to know the topics in this objective:

  1. Expandable Reservation Examples
  2. Expandable Reservation for Resource Pools (VMware Blogs)
  3. Why Use Resources Pools?