In vSphere PowerCLI, you can pass strings and wildcards to all parameters that take inventory objects, datastores, OSCustomizationSpec objects, and VIServer objects as arguments. This vSphere 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:
■
| |
■
| |
■
|
If you provide a non-existing object name, an OBN failure occurs. In such cases, vSphere 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 –MemoryGB 4
If the VM2 virtual machine does not exist on either of the selected servers, vSphere PowerCLI generates a non-terminating error and applies the command only on the VM1 and VM3 virtual machines.