Exporting Virtual Machines with custom properties fails
search cancel

Exporting Virtual Machines with custom properties fails

book

Article ID: 326141

calendar_today

Updated On:

Products

VMware Aria Suite

Issue/Introduction

Correct NULL values in database preventing export of Virtual Machines with custom properties

Symptoms:
  1. When attempting to export Virtual Machines with custom properties using CloudClient in vRealize Automaton 7.4 and lower an error is encountered:
CloudUtil.exe Machine-BulkRegisterExport -f F:\VM_export.csv -u user@domain.com -v --exportNames --managed --properties -i
Exporting 5 VMs ...
System.ArgumentNullException: Value cannot be null.
Parameter name: stringToEscape
at System.Uri.EscapeDataString(String stringToEscape)
at DynamicOps.WorkQueueModel.Client.WorkQueueRegisterHelpers.CreatePropertyString(VirtualMachineProperty prop, Boolean encodeValue)
at DynamicOps.WorkQueueModel.Client.WorkQueueRegisterHelpers.BulkRegisterExport(BulkExportRequest exportRequest)
at DynamicOps.Cdk.Tooling.Commands.BulkRegisterExportCommand.<>c__DisplayClass11.<ExecuteCommand>b__f()
at DynamicOps.Cdk.Tooling.Repositories.UnitOfWork`1.Commit()
at DynamicOps.Cdk.Tooling.Commands.BulkRegisterExportCommand.ExecuteCommand(CommandLineParser parser)
Command succeeded.
  1. Using the vRealize Automation portal to generate a list of machines with custom properties fails with:
"Value cannot be null


Environment

VMware vRealize Automation 7.2.x
VMware vRealize Automation 7.3.x
VMware vRealize Automation 7.4.x
VMware vRealize Automation 7.1.x

Resolution

Problem is resolved in vRealize Automation 7.5 version and higher.

Workaround:
  1. Create a full IaaS database backup using Microsoft SQL Server Management Studio or sqlcmd before updating with the queries below.
  2. Update VirtualMachineProperties table:
update vmp
set PropertyValue = 'null_value'
from [dbo].[VirtualMachine] vm
join [dbo].[VirtualMachineProperties] vmp
  on vmp.EntityID = vm.VirtualMachineID
where vmp.PropertyValue is null
  1. Test the CloudClient or portal export again.

Revert query provided below:
update vmp
set PropertyValue = null
from [dbo].[VirtualMachine] vm
join [dbo].[VirtualMachineProperties] vmp
  on vmp.EntityID = vm.VirtualMachineID
where vmp.PropertyValue = 'null_value'