Use PowerCli to answer VM questions

Recently had a datastore in the lab briefly fill up and some VMs go into a suspended state awaiting a Retry/Cancel question to be answered. Rather than manually answer the question on each affected VM i looked to use PowerCli. With a little digging in the PowerCli documentation I found the Get-VMQuestion & Set-VMQuestion cmdlets. In an ideal world all you would need to do is this

Connect-VIServer -Server VC01
Get-VM | Get-VMQuestion | Set-VMQuestion -Option "Retry" -Confirm:$false
Disconnect-VIServer -Server VC01 -Confirm:$false
As i am using vCD all VMs have a UID appended with a space like this
IaaS01 (c4920308-f901-45be-b99c-0095175099e9)

So when you try to pass the VM name to Get-VMQuestion it does not handle the space in the VM name and the command fails. To get around this i created a simple script to first create an array of VM names thereby avoiding the issue with the space. Running the script below against my vCenter answered about 65 VM questions while i made a coffee!

Connect-VIServer -Server VC01
$vm = @()
$vm = Get-VM
$answerQuestion = $vm | Get-VMQuestion | Set-VMQuestion -Option "Retry" -Confirm:$false
Disconnect-VIServer -Server VC01 -Confirm:$false

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]
GO
delete from QRTZ_SCHEDULER_STATE
delete from QRTZ_FIRED_TRIGGERS
delete from QRTZ_PAUSED_TRIGGER_GRPS
delete from QRTZ_CALENDARS
delete from QRTZ_TRIGGER_LISTENERS
delete from QRTZ_BLOB_TRIGGERS
delete from QRTZ_CRON_TRIGGERS
delete from QRTZ_SIMPLE_TRIGGERS
delete from QRTZ_TRIGGERS
delete from QRTZ_JOB_LISTENERS
delete from QRTZ_JOB_DETAILS
go

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’

Error

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!

vCD vApp Report

Here is a quick one liner for reporting on vCD vApps. This is useful for quickly auditing deployed vApps in vCD. I used the Search-Cloud cmdlet as its lighter and faster than Get-CIvApp. I’m sorting by created date and outputting Created date, vApp Name, Power state, and vApp Owner and outputting the results to a csv file

 

Search-Cloud -QueryType AdminVApp | Sort-Object -Property CreationDate | select CreationDate,Name,Status,OwnerName | Out-File C:\vCDAudit.csv