Today I was running one of my favourite home lab scripts to startup and shutdown my lab environment. Sadly, this ended with a PowerCLI error code. So it was time to investigate what was going wrong because the code did not change but the script stopped functioning at some point.
The first thing we look at is the error message. The following error message was displayed inside my PowerCLI console:
“Start-VM Exception has been thrown by the target invocation”
So it appears the command “Start-VM” is causing some issue. The Start-VM PowerCLI cmdlet is responsible for sending a command to vCenter Server to start a particular virtual machine.
The first thing I noticed the system I was using was not running the most recent version of PowerCLI. So the first thing I did was upgrade PowerCLI from version 6.3 to PowerCLI version 6.5. I rebooted the system and I started the script again. It appeared that all the problems were gone :). So something surrounding the “Start-VM” cmdlet is not working correctly in PowerCLI 6.3. I could not find any information or a changelog entry related to the issue but it fixed “something” :).
The first screenshot displays the script and encountering the issue with PowerCLI version 6.3. The second screenshot the same script is run but with an installed PowerCLI 6.5 version. As you can see the issue is resolved now.