VMware development virtual machine starts and shuts down with the system.
Reasons for Vmware Virtual Machine Development
Windows development is sometimes so unsatisfactory, especially when the services developed need to run in Linux, and there are always some inexplicable problems if you develop in Windows, so it is necessary to develop in Linux.
There are several options for using Linux development environment in Windows, such as WSL2, Hyper-V, VitualBox and Vmware. WSL2 is so tied to Windows that many configurations cannot be done as you wish. Hyper-V is more flexible, but it takes a long time to start up and shut down, and its performance is not very good. The more prominent problem is that I still don’t know how the network topology is, which causes a lot of problems for practical use. VirtualBox has not been used, but because of its open source and free reasons may switch to this in the future. Vmware is the best independent, the configuration and storage of virtual machines are saved in the form of separate files, which is convenient for migration and backup, and its network configuration is more flexible, so it is the first choice for Linux development.
Vmware Virtual Machine Startup and Shutdown
Here a start-up script and a shutdown script are created, both of which read as follows.
Start-up script:
"C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe" start "D:\virtual machine\ubuntu20.04\Ubuntu 20.04 64 位.vmx" nogui
Shutdown script:
"C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe" stop "D:\virtual machine\ubuntu20.04\Ubuntu 20.04 64 位.vmx" soft
Here, we use a GUI-free startup and enable the ssh service to connect remotely, so that we can connect to the VM remotely via ssh for development.
Senseless operation of Vmware virtual machines
We can use the Startup folder or Scheduled Tasks to set the boot-up in Windows, but here we use Group Policy.
To set up.
win+Rto open Run.- Type
gpedit.mscto open the Local Group Policy Editor. - Find User Configuration -> Windows Settings -> Scripts (Logon/Logoff).
- Add the scripts in the previous summary to Logon and Logoff respectively.
After rebooting and shutting down, you can find that the virtual machine is running without any sense.