LucD
Leadership
Leadership

That looks ok.


I just tried your exact code in my test environment, and it creates the scheduled task without an issue.

I'm using PowerCLI 11.2 against a vSphere 6.7 environment.

The error message states that it receives an array where it expects a MoRef.
The only place where that happens is with the 1st parameter to the CreateObjectScheduledTask method, which is the $vm.ExtensionData.MoRef value.

But since you confirmed that $vm only holds a single VM, I have no other explanation where the problem can come from.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos