Almost works although i get this when trying to run it any ideas does the script need to be placed in a directory containing the files??
Scheduling hardware upgrade for 12345678
New-Object : Cannot find type [VMware.Vim.ScheduledHardwareUpgradeInfo]: make sure the assembly containing this type is loaded.
At C:\...\vmhardware.ps1:69 char:50
+ $spec.ScheduledHardwareUpgradeInfo = New-Object <<<< VMware.Vim.ScheduledHardwareUpgradeInfo
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
Property 'scheduledHardwareUpgradeStatus' cannot be found on this object; make sure it exists and is settable.
At C:\Users\...\vmhardware.ps1:70 char:38
+ $spec.ScheduledHardwareUpgradeInfo. <<<< scheduledHardwareUpgradeStatus = 'pending'
+ CategoryInfo : InvalidOperation: (scheduledHardwareUpgradeStatus:String) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
Property 'upgradePolicy' cannot be found on this object; make sure it exists and is settable.
At C:\Users\...\vmhardware.ps1:71 char:38
+ $spec.ScheduledHardwareUpgradeInfo. <<<< upgradePolicy = 'onSoftPowerOff'
+ CategoryInfo : InvalidOperation: (upgradePolicy:String) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
Property 'versionKey' cannot be found on this object; make sure it exists and is settable.
At C:\Users\.....\vmhardware.ps1:72 char:38
+ $spec.ScheduledHardwareUpgradeInfo. <<<< versionKey = 'vmx-09'
+ CategoryInfo : InvalidOperation: (versionKey:String) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
Type : Task
Value : task-5830