The initial setup and main use cases of Powershell Plug-in for vCenter Orchestrator could be found in the previous post here .
In addition, PowerShell plug-in being able to run any PowerShell script doesn’t need some special things to work with PowerCLI scripts. The only thing one should do is to call the “AddPsSnapin” with “VMware.VimAutomation.Core” and it would be possible to use such cmdlets and scripts.
…But probably you would not like to throw away the work you have already done by creation of custom Workflows using the VC Plug-in. You will more probably like to extend it with PowerShell/PowerCLI scripts.
The good news is that you can mix both. This is made possible by a small module we call “Converter”. It actually converts PowerCLI objects into VC Plug-in objects and vice versa. Almost every object that can be seen into the VC Plug-in inventory can be converted.
Exemplary workflows that demonstrate the conversion functionality you will find in “Library/PowerShell/Samples/Converter”. There are a lot of building blocks if you look at its schema, but do not be scared. You only need to call a single action to achieve the conversion.
“convertToVcoObj” action converts the input to a VCO object. And “convertToPsObj” action converts VC:<Object> to PowerShellRemotePSObject.
What does this mean you would say.
This means that if RemotePSObject representing VM is passed as argument the “convertToVcoObj” will return Array/Any with size 1 and VC:VirtualMachine at index 0, which is reffering the same VM that the original RemotePSObject is reffering. Next you can use this object as an argument to any WF/Action that accepts VC:VirtualMachine or you can directly call methods on it.
The following diagram demonstrates this.
The following table shows which types the Converter supports:
PowerCLI type | vCO Object Type |
VMware.VimAutomation.ViCore.Impl.V1.Inventory.VirtualMachineImpl | VC:VirtualMachine |
VMware.VimAutomation.ViCore.Impl.V1.Inventory.TemplateImpl | VC:VirtualMachine |
VMware.VimAutomation.ViCore.Impl.V1.Inventory.DatacenterImpl | VC:Datacenter |
VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.DatastoreImpl | VC:Datastore |
VMware.VimAutomation.ViCore.Impl.V1.Inventory.ClusterImpl | VC:ClusterComputeResource |
VMware.VimAutomation.ViCore.Impl.V1.Inventory.VMHostImpl | VC:HostSystem |
VMware.VimAutomation.ViCore.Impl.V1.Inventory.ResourcePoolImpl | VC:ResourcePool |
VMware.VimAutomation.ViCore.Impl.V1.VM.SnapshotImpl | VC:VirtualMachineSnapshot |
VMware.VimAutomation.ViCore.Impl.V1.Inventory.FolderImpl | VC:DatastoreFolder |
VMware.VimAutomation.ViCore.Impl.V1.Inventory.FolderImpl | VC:DatacenterFolder |
VMware.VimAutomation.ViCore.Impl.V1.Inventory.FolderImpl | VC:HostFolder |
VMware.VimAutomation.ViCore.Impl.V1.Inventory.FolderImpl | VC:VmFolder |
If you wonder what actually the converter does behind the scenes look at the diagram below.