esxi管理

/ nat / 0 条评论 / 391浏览
 services.sh restart 重启所有的服务 

 esxcli vm

#vim-cmd https://www.jianshu.com/p/f9c30b3732fb
vim-cmd vmsvc/getallvms  #获取所有vm

 function start-vmrc ($vm)
{
$si=get-view serviceinstance
$sm=get-view $si.content.sessionmanager
$ticket=$sm.acquirecloneticket()
$vmid=($vm|get-view).moref.value
$vc=$vm.uid.substring($vm.uid.indexof(“@”)+1,$vm.uid.indexof(“:”)-$vm.uid.indexof(“@”)-1)
& ‘C:\Program Files (x86)\VMware\VMware Remote Console\vmrc.exe’ “vmrc://clone:$($ticket)@$($vc)/?moid=$($vmid)”
https://www.virtuallyghetto.com/2014/10/standalone-vmrc-vm-remote-console-re-introduced-in-vsphere-5-5-update-2b.html
旧版本连接:  vmware-vmrc.exe” -h Host -u User -p Password “[datastore1] VM/VM.vmx”

1.
https://192.168.22.58/mob/?moid=SessionManager&method=acquireCloneTicket  获取ticket   //输入用户名密码
2. 
vmrc.exe vmrc://clone:ticket@192.168.22.54/?moid=44
vmrc.exe vmrc://192.168.22.54/?moid=44   #22.162
vmrc.exe vmrc://192.168.22.54/?moid=42   #22.230

https://github.com/josenk/esxi-vm-create/blob/master/.gitignore
修改:
(stdin, stdout, stderr) = ssh.exec_command("echo " + line + " >>" + MyVM + ".vmx")
(stdin, stdout, stderr) = ssh.exec_command("echo " + line.replace("\"","\\\"") + " >>" + MyVM + ".vmx")  
vmkfstools -c 40G -d eagerzeroedthick  a.vmdk

(stdin, stdout, stderr) = ssh.exec_command("vmkfstools -w " + " " + MyVM + ".vmdk")

/root/.esxi-vm.yml   ===全局设置
/opt/esxi-vm-create  ====esxi
scp SAG-5.3.0.5-7.2.iso  root@192.168.22.54:/vmfs/volumes/58ab0e05-95395aac-775d-002590878b5a/

./esxi-vm-create -H 192.168.22.54 -P wj770826 -u  # -u 更新到配置文件中
./esxi-vm-create -n SAG_22.150 -N 'VM Network' -S datastore1 -c 1 -m 4 -v 40 -i SAG-5.3.0.5-7.2.iso --verbose --summary
./esxi-vm-create -n SAG_22.151 -N 'VM Network' -S datastore1 -c 1 -m 8 -v 40 -i UEM.5.2.0.520000180.iso  --verbose --summary

vim-cmd solo/registervm /vmfs/volumes/datastore1\ \(2\)/SAG_22.150/SAG_22.150.vmx  #注册虚拟机
 vim-cmd vmsvc/unregister 69   #解除注册


esxi克隆vmdk
vmkfstools --clonevirtualdisk CentOS5.5X64template_bydeams-20110112.vmdk vmtemplate.vmdk -d thin

wmic + process: 
查看所有进程的启动参数