I am going to share some method and scripts here to solve this out.
Software (I assume the software, virtual machine are setup properly):
- Windows XP SP3, with auto login enabled
- VMWare Workstation 6.5
- Bitvise Tunnelier
Note: Change the text in RED according to your case
STEP 1 - Auto Start
- Enable Auto login (It can be done by using Windows' Free Tweak UI application. Please search the web for further setup.
- In VM workstation, In [Edit]-[Preference] setting, select "Workspace" tab. Check "Keep VMs running after Workstation closes"
- Create a new text file named something like autostart_vms.bat with below LINE:
"C:\Program Files\VMware\VMware VIX\vmrun.exe" -T ws start "D:\VirtualMachines\homeserver.vmx" nogui
- Save this batch file in startup folder. In general, it should be:
C:\Documents and Settings\All Users\Start Menu\Programs\Startup\" - Reboot and check the VM can be started automatically.
- Since I cannot let vmrun.exe to send a poweroff command to Linux, I need to send remote command thru SSH. Please setup NAT in Virtual Network correctly
- Start Group policy editor: (Start Menu)->Run-> Type gpedit.msc
- Locate Script-shutdown like this:

(Ref.: http://vlaurie.com/computers2/Articles/group_policy_editor.htm) - Create a new text file named something like shutdown_vms.bat with below LINES:
"C:\Program Files\Bitvise Tunnelier\sexec.exe" yourusername@localhost:22 -pw=yourpasswd -cmd="sudo poweroff"
sleep 30
"C:\Program Files\VMware\VMware VIX\vmrun.exe" -T ws poweroff "D:\VirtualMachines\homeserver.vmx" - Note that, the sleep time may variate due to the time taken by linux shutdown. Adjust this value according to your needs.
- Save this batch file in policy shutdown folder. In general, it should be:
C:\WINDOWS\System32\GroupPolicy\Machine\Scripts\Shutdown - Shutdown and check it is functioning.
沒有留言:
發佈留言