Vmware批量开关机脚本

运行Windows脚本批量开关Vmware虚拟机

1、vmrun -T ws start “/opt/VMware/win2k8r2.vmx” nogui启动无图形界面虚拟机 (-T 是区分宿主机的类型,ws|server|server1|fusion|esx|vc|player,可能比较常用的是ws、esx和player,不过我没有加-T在Workstation也能正常运行, 可能esx和server就需要了)
2、vmrun start “/opt/VMware/win2k8r2.vmx” gui启动带图形界面虚拟机
3、vmrun stop “/opt/VMware/win2k8r2.vmx”hard | soft强制关闭虚拟机(相当于直接关电源) | 正常关闭虚拟机

批量开机脚本:

start.bat
cd D:\Vmware                                                        #进入安装Vmware软件的目录
vmrun start "D:\虚拟机\vm1\vm1.vmx" nogui
vmrun start "D:\虚拟机\vm2\vm2.vmx" nogui
vmrun start "D:\虚拟机\vm3\vm3.vmx" nogui
vmrun start "D:\虚拟机\vm4\vm4.vmx" nogui
vmrun start "D:\虚拟机\vm5\vm5.vmx" nogui

批量关机脚本:

stop.bat
cd D:\Vmware
vmrun stop "D:\虚拟机\vm1\vm1.vmx" soft
vmrun stop "D:\虚拟机\vm2\vm2.vmx" soft
vmrun stop "D:\虚拟机\vm3\vm3.vmx" soft
vmrun stop "D:\虚拟机\vm4\vm4.vmx" soft
vmrun stop "D:\虚拟机\vm5\vm5.vmx" soft

你可能感兴趣的:(运维)