In PowerCLI, all parameters that take inventory objects, datastores, OSCustomizationSpec objects, and VIServer objects as arguments can be specified by strings and wildcards. This PowerCLI approach is called Object-by-Name (OBN) selection.

Instead of assigning an object name to a cmdlet parameter, users can pass the object through a pipeline or a variable. For example, the following three commands are interchangeable:

Remove-VM -VM "Win XP SP2"

Get-VM -Name "Win XP SP2" | Remove-VM

Remove-VM -VM (Get-VM -Name "Win XP SP2")

Note

In VMware vSphere PowerCLI, passing strings as pipeline input is not supported.

If you provide a non-existing object name, an OBN failure occurs. In such cases, PowerCLI generates a non-terminating error and runs the cmdlet ignoring the invalid name.

For more details about OBN, run help about_OBN.

This example illustrates the occurrence of an OBN failure.

Set-VM –VM “VM1”, “VM2”, “VM3” –Server $server1, $server2 –MemoryMB 512

If the VM2 virtual machine does not exist on either of the specified servers, PowerCLI generates a non-terminating error and applies the command only on the VM1 and VM2 virtual machines.