VMware Cloud Community
antoniogemelli
Hot Shot
Hot Shot

Shutdown/poweroff VM from a txt list

Hello,

I would like to ask if someone can share a powershell script where I can choose to shutdown guest and/or poweroff VM from a txt list, and get result output in a csv or txt file.

Thanks

Tags (2)
24 Replies
LucD
Leadership
Leadership

Not sure what you mean by that?
You want to test the content of those properties in the If statement?


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

Reply
0 Kudos
BGONZALES_ASH
Contributor
Contributor

we have a long list of VM's to realign the compute on, they are each getting a predetermined amount based on usage.

Was thinking to check the allocated compute just to ensure the server owner did not already realign the CPU & RAM, along with checking if VMtools are running, and if not reboot.

The last maintenance, some VM's powered down, but did not have their compute adjusted, nor were they powered back on, upon checking, those VM's did not have VMtools running. Is there a way to have the script run without VMtools running?

Reply
0 Kudos
LucD
Leadership
Leadership

Ok, got it (I think).

Try the attached script.
If there are no VMware Tools running, the ToolsStatus and ToolsVersion properties will be blank.


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

Reply
0 Kudos
BGONZALES_ASH
Contributor
Contributor

Thanks Luc!  Seems like there may be an issue with that attachment, getting the file incomplete message upon download.. Thanks again..

Reply
0 Kudos
LucD
Leadership
Leadership

Seems to be working fine for me, tested from 2 locations.
Might be that the VMTN site had some hiccups.


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

Reply
0 Kudos