Two (or three) different ways
Using network boot via PXE server.
I've used a trick like this for backup windows stations (with ntfsclone or partclone) while users are away, by night.
Create a PXE boot server (dhcpd + tftpd) for booting via network
( You could create specific boot menu for each computer on a network or make group. The network boot menu could point to local hard drive. )
Prepare two different boot menu on this server: one defaulting to ubuntu and the other defaulting to window.
Link boot menu defaulting to window to be served by pxe server.
Prepare a wakeup script for
- ) Link boot menu defaulting to ubuntu to be served by pxe server.
- ) Send wake-on-lan signal to wake the computer up
- ) Wait for boot menu request in TFTP logs (care about timeout and limits, for assuming exception).
- ) Link boot menu defaulting to window to be served by pxe server.
You could even try to run same via crontab to be synchronized by BIOS wakup, but if in crontab, you could simply run script defined at 4..
This will do the job.
(Nota a pxe boot server is light and could be installed even on a raspberry pi, an hacked NAS or on a DD-WRT router, for sample.).
Using dmidecode info
You could use dmidecode to run grub-reboot windows when boot from power-switch.
Simply create a script containing something like:
/bin/sh
dmidecode | grep -q 'Wake-up Type: Power Switch' && echo grub-reboot windows
reboot
You can run this script at each boot, by adding them in crontab with @reboot directive.
(Nota: for grub-reboot, you may have to edit /etc/default/grub. see man grub-reboot)
This will work but will increase windows boot time a lot!
For avoiding this, you could create a special initramdisk wich could do this job, but this is not as simple.
Using ipxe (maybe)
I don't know this tool, but I heard good feed-backs.
iPXE is the leading open source network boot firmware. It provides a full PXE implementation enhanced with additional features