Here is a way how to quickly determine the machine type to be deployed without resorting to the ‘VirtualMachineExt’ object (which by the way is not yet available in the ‘BuildingMachine’ state):
# $vm is a VirtualMachine entity PS > $vm.GetType().FullName DynamicOps.ManagementModel.VirtualMachine PS > $vm.MachineType 0 PS > [DynamicOps.ManagementModel.Common.Enums.MachineTypeT].GetEnumName($vm.MachineType) Virtual # Check if machine is a Virtual Machine if([DynamicOps.ManagementModel.Common.Enums.MachineTypeT]::Virtual.value__ -eq $vm.MachineType) { # do something } else { # do something else } # if
In case you wonder what other machine types exist you can check the enumeration like this:
PS > [DynamicOps.ManagementModel.Common.Enums.MachineTypeT].GetEnumNames() Virtual Physical Cloud AppService vApp
Though this can easily be achieved in a different manner, the point is it is really useful to explore the ‘DynamicOps.ManagementModel.Common’ assembly so you do not have to hard code properties like ‘Virtual’ or ‘__clone_from’ and the like …