VIX的几个常用命令

本文介绍了在VMware ESX环境中管理虚拟机的一些常用命令,包括列出运行中的VM、启动和停止VM、查看快照、回滚到特定快照、在虚拟机中执行程序和脚本、以及文件的主机与客户机间拷贝操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

测试到一定规模后,不免会用到虚拟机,针对VMware esx,列出几条常用的命令:

 

1. 列出esx server上的vm的存储路径(仅列出正在运行的vm)

vmrun -T esx -h https://ServerIP/sdk -u ServerUserName -p ServerPassword list

 

2. 启动某一个vm

vmrun -T esx -h https://ServerIP/sdk -u ServerUserName -p ServerPassword start "[datastore1] vmname/vmname.vmx"

 

3. 停止某一个vm

vmrun -T esx -h https://ServerIP/sdk -u ServerUserName -p ServerPassword stop "[datastore1] vmname/vmname.vmx"

 

4. 列出某个vm上的所有snapshot

vmrun -T esx -h https://ServerIP/sdk -u ServerUserName -p ServerPassword listsnapshots "[datastore1] vmname/vmname.vmx"

 

5. revert到指定vm上的指定snapshot

vmrun -T esx -h https://ServerIP/sdk -u ServerUserName -p ServerPassword revertToSnapshot "[datastore1] vmname/vmname.vmx" snapshotname

注意:此条命令对于esx 3.5版本无效,ref: http://www.vmware.com/support/developer/vix-api/VIX-1.6.2-ReleaseNotes.html

 

6. 执行vm上的某个程序

vmrun -T esx -h https://ServerIP/sdk -u ServerUserName -p ServerPassword -gu VMUserName -gp VMPassword runProgramInGuest "[datastore1] vmname/vmname.vmx" -interactive "c:/windows/system32/cmd.exe"

 

7. 执行vm上的某个bat

vmrun -T esx -h https://ServerIP/sdk -u ServerUserName -p ServerPassword -gu VMUserName -gp VMPassword  runScriptInGuest "[datastore1] vmname/vmname.vmx" "" "cmd.exe /k /"C://Program Files//Microsoft Visual Studio//VC//vcvarsall.bat/" x86"

注意:设置bat的解释器为""

 

8. Copy file from guest to host

vmrun -T esx -h https://ServerIP/sdk -u ServerUserName -p ServerPassword -gu VMUserName -gp VMPassword  copyFileFromGuestToHost "[datastore1] vmname/vmname.vmx" "c:/temp/test.xml" "//192.168.0.1/Shared/test.xml"

 

9. Copy file from host to guest

vmrun -T esx -h https://ServerIP/sdk -u ServerUserName -p ServerPassword -gu VMUserName -gp VMPassword  copyFileFromHostToGuest "[datastore1] vmname/vmname.vmx" "//192.168.0.1/Shared/test.xml" "c:/temp/test.xml"

 

其他命令还有:

listProcessInGuest, killProcessInGuest, stop(power off vm), reset (reboot vm),

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值