Extending PowerCLI objects with the New-VIProperty cmdlet
Sometimes you can have the feeling that a PowerCLI object is missing a property. Although the VMware PowerCLI team tried to include the most useful properties in the objects, you can have the need for an extra property. Luckily, PowerCLI has a way to extend a PowerCLI object using the New-VIProperty
cmdlet. This cmdlet has the following syntax:
New-VIProperty [-Name] <String> [-ObjectType] <String[]> [-Value] <ScriptBlock> [-Force] [-BasedOnExtensionProperty <String[]>] [-WhatIf] [-Confirm][<CommonParameters>] New-VIProperty [-Name] <String> [-ObjectType] <String[]> [-Force] [-ValueFromExtensionProperty] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
Let's start with an example. You will add the VMware Tools' running statuses used in a previous example to the VirtualMachineImpl
object using the New-VIProperty
cmdlet:
PowerCLI C:\> New-VIProperty -ObjectType VirtualMachine...