INTERACTIVE: ssh root@10.10.10.240 NON INTERACTIVE: ssh root@10.10.10.240 'df -h' (additionally use public/private ssh keys or "expect" scripting to automatically enter in a password)
FIND A SPECIFIC VM ID
vim-cmd vmsvc/getallvms | grep -i "QA" vim-cmd vmsvc/getallvms | grep -i "QA" | awk '{print $1}'
vim-cmd vmsvc/snapshot.get | vim-cmd vmsvc/getallvms | grep -i "QA" | awk '{print $1}' vim-cmd vmsvc/getallvms | grep -i 'QA' | cut -f 1 -d ' '
vmsvc/snapshot.get vmid
reverting to the Root is very strange and Branches apparently 0 1 0 will load a Child
vim-cmd /vmsvc/snapshot.revert 320 0 0 0
http://communities.vmware.com/thread/230475
Commands available under /vmsvc/: acquiremksticket get.configoption power.on acquireticket get.datastores power.reboot connect get.disabledmethods power.reset convert.toTemplate get.environment power.shutdown convert.toVm get.filelayout power.suspend createdummyvm get.guest power.suspendResume destroy get.guestheartbeatStatus queryftcompat device.connection get.managedentitystatus reload device.connusbdev get.networks setscreenres device.disconnusbdev get.runtime snapshot.create device.diskadd get.snapshotinfo snapshot.dumpoption device.diskaddexisting get.summary snapshot.get device.diskremove get.tasklist snapshot.remove device.getdevices getallvms snapshot.removeall device.toolsSyncSet gethostconstraints snapshot.revert device.vmiadd login snapshot.setoption device.vmiremove logout tools.cancelinstall devices.createnic message tools.install get.capability power.getstate tools.upgrade get.config power.hibernate unregister get.config.cpuidmask power.off upgrade
mkdir /vmfs/volumes/datastore1/newvm
vmkfstools -c 15G -a lsilogic newvm.vmdk
CONTROL BY
vmware-vim-cmd /vmsvc/snapshot.create 61 SnapshotName SnapshotDescription true vmware-vim-cmd /vmsvc/snapshot.get 61
chmod 744 newvm.vmx
cat or echo?
Created a VMX file with the following text. The site http://sanbarrow.com/vmx.html is a great resource for looking up information on VMX files.
config.version = "8" virtualHW.version= "7" guestOS = "winnetenterprise-64" memsize = "1024" displayname = "VirtualCenter" scsi0.present = "TRUE" scsi0.virtualDev = "lsilogic" scsi0:0.present = "TRUE" scsi0:0.fileName = "VirtualCenter.vmdk" ide1:0.present = "true" ide1:0.deviceType = "cdrom-image" ide1:0.filename = "/vmfs/volumes/4a68046d-2159a120-ebac-001a9253e68f/win2k3_x64.iso" ide1:0.startConnected = "TRUE" ethernet0.present= "true" ethernet0.startConnected = "true" ethernet0.virtualDev = "e1000"
vim-cmd vmsvc/getallvms
The below lines were added to the VMX file (after?) when it was added to inventory.
scsi0:0.deviceType = "scsi-hardDisk" floppy0.fileName = "/dev/fd0" extendedConfigFile = "VirtualCenter.vmxf" virtualHW.productCompatibility = "hosted" tools.upgrade.policy = "manual"
MANUALLY INSTALL VMWARE TOOLS vim-cmd vmsvc/tools.install 16
The below lines were then added to the VMX file to enable VNC client access. Note that if you're doing this with ESX, you'll want to edit the firewall to open this port. With ESXi there is no firewall to change so you don't have to worry about that.
RemoteDisplay.vnc.enabled = "True" RemoteDisplay.vnc.port = "5901" RemoteDisplay.vnc.password = "secure"
ethernet0.networkName = "VM Network" ? vim-cmd vmsvc/reload 16
The VM was then powered on and I connected with a VNC client (TightVNC).
http://vm-help.com/esx40i/manage_without_VI_client_1.php