关闭

VIX的几个常用命令

标签: vmwarefile虚拟机serverlist测试
2145人阅读 评论(0) 收藏 举报
分类:

测试到一定规模后,不免会用到虚拟机,针对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),

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:154119次
    • 积分:1924
    • 等级:
    • 排名:千里之外
    • 原创:29篇
    • 转载:2篇
    • 译文:0篇
    • 评论:5条
    文章分类
    最新评论