I think that is a snippet I slapped together, I recognized the name of the file. The first issue of not seeing any output was an error on my part. I had the wrong value in the regex. I updat...
See more...
I think that is a snippet I slapped together, I recognized the name of the file. The first issue of not seeing any output was an error on my part. I had the wrong value in the regex. I updated that to the proper value, you should see the VMs now. I verified it in my environment as well. As for the error, looks like the VirtualDevice list of one or more Virtual Machines was undefined. I added a few lines to the snippet. The first fixes the password prompt subroutine, returning the terminal mode back from noecho so you can actually type again if you're in a terminal or cmd prompt. The second was to add a check to see if the VirtualDevice list is undefined and print out the Virtual Machine that is the particular problem. This might provide some insight on which Virtual Machine is returning an undefined value for the VirtualDevice list. Even a bare minimal VM with just CPU/Memory defined will not trigger that condition (at least in my current environment). Something else is going on. Sorry that it didn't work the first time, I didn't add a lot of error checking. I just put it together as an example of how to enumerate devices and determine their hardware class as a way to locate particular virtual devices before calling specific class functions on the object. Try this updated version, it might point a finger at the culprit or at the very least skip the troublesome Virtual Machine(s). If you can determine the VM's with the issue, I'd like to hear about it.