Category Archives: TipsNTricks

Error restoring SRM placeholder VM

I’ve been doing some lab work this week staging a vSphere 6.0U1b with SRM 6.0 environment for some upgrade scenario testing and i hit an issue with SRM 6.0 that i had not seen before. When trying to restore the SRM placeholder VM for a protected VM I was getting the following error

No hosts with hardware version ‘7’ and datastore(s) “NFS02” which are powered on and not in maintenance mode are available


Seemed like a pretty odd error given that my target host is 6.0 and it has the NFS02 datastore mounted. I checked all the obvious to ensure there were no host issues and then went on the KB hunt. Tried the solution outlined here to no avail

Also tried this, again no joy.

As a last ditch effort i tried rebooting the target ESXi host and that fixed the issue and I was then able to restore the placeholder VM and continue testing. Not sure on the root cause. This is a fully nested environment, using vSphere Replication & a VNX File appliance so it may just be environmental. Will update this post if i figure it out!

Onwards with testing!

Setting up a VMware Appliance update repo

When upgrading VMware appliances using the vami configuration interface the update that is available from VMware does not always match the version you want. mounting an ISO to the VM is not always possible (vCloud Director hosted VMs are an example). Follow this procedure to create a temporary repo to make the correct upgrade bundles available during appliance upgrade
In this example the vRA appliance is used to host the repo. Any VMware appliance can be used for this purpose.
1. SCP the upgrade ISO to /tmp on the vRA appliance
2. SSH to the vRA appliance and navigate to the tmp directory

 cd /tmp

3. Create a new directory called repo

Mkdir repo
 4. Type the following to mount the upgrade ISO to the new repo directory
mount -o loop "iso name" repo
 5. Change directory into repo/update
 cd repo/update
 6. Start the python SimpleHTTPServer
 python -m SimpleHTTPServer
 7. Return to the VAMI configuration interface of the appliance that you are upgrading and browse to the Update tab
 8. Click Settings
 9. Change the Update Repository option to Use Specified Repository
 10. For Repository URL enter http://vRA-FQDN:8000
 Note: Enter the FQDN of the appliance you are using. This may not be the vRA appliance
 11. Click Save Settings
 12. Click Status and click Check Updates
 13. The correct version that you copied to the temporary repo should be available to install

Reload all invalid virtual machines on a single host

From time to time VMs can show in an invalid state in vCenter. It can be difficult to get them back to a normal state. This is a useful command that i found at the end of this KB

for a in $(vim-cmd vmsvc/getallvms 2>&1 |grep invalid |awk '{print $4}'|cut -d \' -f2);do vim-cmd vmsvc/reload $a;done

If you get an Unexpected token error when running the above command it is probaby due to wordpress messing up the ‘ characters so either replace them or copy the command from the KB!

Quick linux tip: Find all listening ports

This is probably widely known but every time i need to do it i need to search for the commands so putting this here so i can easily find it the next time i need it! 🙂

netstat -pnlt | sort



Find MoRef ID using powercli

From time to time you need to find the moref of an object in vCenter. This is a quick powercli one liner to get the name and ID of an object type (VM, Datastore etc)

This assumes you are already connected to vCenter using Connect-VIServer

# Datastores

Get-Datastore | Select Name,ID

This command returns output like below. In this example i have 1 datastore



Get-VM | Select Name,ID

This command returns output like below


Reset VMware appliance root password

Use the following procedure to change the root password for a VMware appliance. This process uses single user mode so it allow you to change the root password if you have forgotten it!

Open the VM console and reboot the appliance


Select the line that starts with kernel and type e to edit the line

At the end of the line, press the spacebar and type init=/bin/sh

Press Enter to exit edit mode.

On the GRUB screen, type b to boot into single-user mode.
The virtual appliance boots in single-user mode.

To change the root user password, type passwd root and follow the on-screen prompts to enter a new password for the root user

To restart the virtual appliance, type reboot and press Enter.

When the virtual appliance restarts, you can log in using the new password.

vCloud Director Error: None of the cells have a vCenter proxy service running

Came across this issue in the lab today when trying to deploy a vApp template from the vCD catalog

vCD Proxy Error


Did some googling and came across a post by Jason Boche here that points to an issue with the QRTZ SQL tables (Who knew!). Thanks to Jason’s post i was able to run the script below to delete some rows from the tables. Once i restarted my vCD cells i was again able to deploy vApps. Script below (modified by jason to adhere to upper case table names). Be sure to stop all vCD cells and backup the SQL DB before executing. Change the DB name to whatever your DB is called


USE [vcloud]
delete from QRTZ_CALENDARS
delete from QRTZ_TRIGGERS
delete from QRTZ_JOB_DETAILS

Not sure yet what caused this but the only event i know of was a vCenter restart 2 days ago. Will update this post if i find the root cause.

Importing VCSA 5.5 into vCD catalog fails

Importing VCSA 5.5 into vCD catalog fails with error Duplicate element ‘AnnotationSection’


To get around this error you need to edit the OVF file.

Disclaimer: I’m pretty sure that manually editing the OVF is not supported by VMware!

I had a VCSA ova so i first extracted the OVF using 7zip. Once extracted open the .ovf file in a text editor and look for the AnnotationSection

OVF Edit

Highlight the section and delete it. Save the file. Because the manifest file is a checksum validation will fail so the quickest solution is to delete the .mf manifest file.

The OVF should then import to vCD successfully!