在esxi上:获取vm列表,批量给vm关机,批量给vm强制关机

#!/bin/sh

vim-cmd vmsvc/getallvms | grep Jump-Node 

for i in `vim-cmd vmsvc/getallvms | grep Jump-Node | awk '{print $1}'` ; do vim-cmd vmsvc/power.off $i ; done

for i in `vim-cmd vmsvc/getallvms | grep Jump-Node | awk '{print $1}'` ; do vim-cmd vmsvc/destroy $i ; done

vim-cmd vmsvc/getallvms | grep Jump-Node 

 

posted @ 2024-01-05 20:50  三角形  阅读(69)  评论(0编辑  收藏  举报