In PowerCLI, you can pass strings and wildcards to all parameters that take inventory objects, datastores, OSCustomizationSpec objects, and VIServer objects as arguments. This PowerCLI approach is named 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 7 SP1"

Get-VM -Name "Win 7 SP1" | Remove-VM

Remove-VM -VM (Get-VM -Name "Win 7 SP1")

Note

In 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-VMVM “VM1”, “VM2”, “VM3” –Server $server1, $server2 –MemoryGB 4

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