Uncategorized

ManagedObjectReference Made Easier

PowerCLI 4.1 introduces easier way to initialize ManagedObjectRefernce (MoRef) instances which are necessary while playing with the Get-View cmdlet.

Till now there were several ways to get MoRefs. The most popular one is to get the view object and to use its MoRef property. Another approach is to parse the values of the ID into two parts – type and value.

For example, to convert virtual machine hard disks to thin-provisioned format it is necessary to have the target datastore MoRef: