AutoDeploy Failed to convert ItemList

When working with VMware vSphere AutoDeploy and creating or editing rules I sometimes get the following error when running a Get-DeployRule: “Failed to convert ItemList to VI Object: System.NullReferenceException: Object reference not set to an instance of an object” (See screenshot).

Often I also have one or more rules not working correctly then. Turns out that an unsupported character had been using when creating the rule. This sometimes happens when using your comma’s or spaces incorrectly. Then the command seems to work but the properties end up in the incorrect fields.

Easiest solution is to delete the rule you just created. In the screenshot you can see how the firs rule has the entry $null in one of its properties. By running the following command you can remove the Deploy Rule completely:

Remove-DeployRule -Delete <Name of deployrule>

Don’t forget the -delete option because without it, it will only remove the deploy rule from the Active deployrule set. Using the -delete option will also remove it from the whole deploy rule set.