Jump to content











Photo
- - - - -

Running Virtual Machines within WinPE

winpe virtual pxe hyperv host

  • Please log in to reply
9 replies to this topic

#1 DanG1T

DanG1T
  • Members
  • 2 posts
  •  
    United Kingdom

Posted 18 November 2018 - 01:40 PM

Bit of a fun project I'm working on...

 

Running WinPE as a server OS, live from the network.

I have a set of scripts that are dynamically returned depending on the MAC Address of the client requesting them,

essentially bootstrapping what ever app/script is required into WinPE.

If the box dies or the OS reboots, no big deal. The apps I've written are designed to work with this (self-healing etc.)

 

It all works! Looking to take it a step further:

 

Now comes the big ask - Has anybody tried (or even started to try) and get VMs to run inside WinPE with SMB shares mounted for VM disk storage?

 

I've only seen one instance of someone trying to get virtualbox to run with little results.

 

Would be happy to show some of the code I have!

 

5jT6fBg.png


  • Brito likes this

#2 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 18 November 2018 - 03:56 PM

Have look at possible portable versions for virtualbox, vmware workstation, ms virtualserver, etc?

 

Of all virtualisation softwares, QEMU is maybe the easiest one : portable, little or no dependency, etc ...

 

Now question is : why would you run a VM in Winpe?

Is not this easier to "just" boot another machine over the network since you are into booting over the network.

 

About SMB, consider other solutions such as iscsi, aoe, etc to take it lower into the OSI layers and not have to mess with ACL's.

 

Cheers,

Erwan



#3 RoyM

RoyM

    Frequent Member

  • .script developer
  • 420 posts
  • Interests:"Booting and Owning".
  •  
    United States

Posted 18 November 2018 - 07:49 PM

Below worked fine.
qemu-system-x86_64.exe file version=(2.1.3.0)
qemu-system-x86_64.exe -boot d -m 2048 -cdrom "E:\10PE2\ISO\Win10PESE_x64.iso" -L "E:\Qemu\pc-bios"
 
My Setup= Toshiba Satellite C655D-S5518 w/6G Ram, 1T SSD, Booting Grub4Dos --> Win10PESE_x64.iso== 2.25G
I also run PeBakery on Toshiba to build the very .iso that it boots from.
The qemu I am using is the one that comes with PeBakery.
(Above is a dedicated field-laptop running Win10_x64 and RTL-SDL's)
 
I currently have an HP Proliant ML150 Gen3, 2 Quad Cpus, with Raid10 Arrays. @16G Ram ECC
That I run a Win7PE_x64 on and use for testing and simple file sharing.
I would be happy to see some of the code you have, In return I can assist.
 
Regards
RoyM

Edited by RoyM, 19 November 2018 - 03:00 AM.
Added ram specs


#4 DanG1T

DanG1T
  • Members
  • 2 posts
  •  
    United Kingdom

Posted 19 November 2018 - 11:29 PM

Have look at possible portable versions for virtualbox, vmware workstation, ms virtualserver, etc?

 

Of all virtualisation softwares, QEMU is maybe the easiest one : portable, little or no dependency, etc ...

 

Now question is : why would you run a VM in Winpe?

Is not this easier to "just" boot another machine over the network since you are into booting over the network.

 

About SMB, consider other solutions such as iscsi, aoe, etc to take it lower into the OSI layers and not have to mess with ACL's.

 

Cheers,

Erwan

 

I completely forgot about QEMU! Good shout, I'll take a look next weekend when I have a bit of time :)

 

As for running VMs in WinPE, my project is going to run services anyway, why not make it able to run anything?

 

iSCSI is certainly an option to explore, I know its relatively simple getting iSCSI Initiator in there and I can script it easily.

The problem is at the server end for making iSCSI LUNs on the fly, but its very easy with SMB - I use SMB all the time and can deal with ACLs. Go look at the state machine for iSCSI, fuck building that lol https://tools.ietf.org/html/rfc7143

 

 

 

Below worked fine.
qemu-system-x86_64.exe file version=(2.1.3.0)
qemu-system-x86_64.exe -boot d -m 2048 -cdrom "E:\10PE2\ISO\Win10PESE_x64.iso" -L "E:\Qemu\pc-bios"
 
My Setup= Toshiba Satellite C655D-S5518 w/6G Ram, 1T SSD, Booting Grub4Dos --> Win10PESE_x64.iso== 2.25G
I also run PeBakery on Toshiba to build the very .iso that it boots from.
The qemu I am using is the one that comes with PeBakery.
(Above is a dedicated field-laptop running Win10_x64 and RTL-SDL's)
 
I currently have an HP Proliant ML150 Gen3, 2 Quad Cpus, with Raid10 Arrays. @16G Ram ECC
That I run a Win7PE_x64 on and use for testing and simple file sharing.
I would be happy to see some of the code you have, In return I can assist.
 
Regards
RoyM

 

 

Fantastic to hear! I'll grab that version and throw it in the provisioning script to see if i can get it to boot and auto start a VM.

Next will come network support...

 

As for the code, it starts with a TFTP Server just to boot a rom-o-matic build of iPXE to start the fun stuff.

I'm using a good .NET library called TFTP.net that's very event-y.

It also starts an HTTP Server for all boot files and WIMs, which I'm going to build database interaction into so you can define what you want each client to load and what config to run.

iPXE then pulls down a config depending on the MAC address of the boot NIC:

chain --autofree http://pecloud.hexagon.red/ipxe/${net0/mac}/menu.ipxe || echo ${HTTP_ERR}

I then wrote an HTTP router similar to ExpressJS to handle the same kind of syntax, which in the future when I hook it up to a db should simplify things:

    Sub InitPXERoutes()
        _parentRouter.AddRoute("/boot.ipxe", AddressOf ChainLoader)
        _parentRouter.AddRoute("/boot.cfg", AddressOf BootConfigLoader)
        _parentRouter.AddRoute("/menu.ipxe", AddressOf MenuLoader)
        _parentRouter.AddRoute("/wimboot", AddressOf Wimboot)
        _parentRouter.AddRoute("/windows.ipxe", AddressOf WinLoader)
        _parentRouter.AddRoute("/windows/bootmgr", AddressOf Windows)
        _parentRouter.AddRoute("/windows/boot/bcd", AddressOf Windows)
        _parentRouter.AddRoute("/windows/boot/boot.sdi", AddressOf Windows)
        _parentRouter.AddRoute("/windows/sources/boot.wim", AddressOf Windows)
        _parentRouter.AddRoute("/init.ps1", AddressOf PowerShellInit)
        _parentRouter.AddRoute("/init/:macaddress/init.ps1", AddressOf PowerShell)
        _parentRouter.AddRoute("/ipxe/:macaddress/menu.ipxe", AddressOf IPXEInit)
    End Sub
        Select Case context.Request.Url.AbsolutePath
            Case "/windows/bootmgr"
                HttpRouter.returnFile(context, "C:\Users\Dan\Documents\hbcd\x64\bootmgr")
            Case "/windows/boot/bcd"
                HttpRouter.returnFile(context, "C:\Users\Dan\Documents\hbcd\x64\boot\bcd")
            Case "/windows/boot/boot.sdi"
                HttpRouter.returnFile(context, "C:\Users\Dan\Documents\hbcd\x64\boot\boot.sdi")
            Case "/windows/sources/boot.wim"
                HttpRouter.returnFile(context, "C:\PESE\ISO\TI\WIM\sources\boot.wim")
        End Select

It's very simple at the moment for testing things but I can't wait to build it into something that could deploy a whole farm of servers in a matter of minutes!

 

Arguably I could have done a very similar thing with a linux based OS (which would probably be better for VM Stuff) but my original idea was to run .NET apps native without mono.



#5 Brito

Brito

    Platinum Member

  • .script developer
  • 10616 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 20 November 2018 - 08:52 AM

QEMU is well tested and works OK.

 

Best would be VirtualBox because of the hardware acceleration. It was possible many years ago, not sure if the older scripts would be up-to-date for this task in current days.

 

:cheers:



#6 stayboogy

stayboogy

    Member

  • Members
  • 49 posts
  •  
    United States

Posted 15 December 2018 - 04:48 PM

man, i have been trying for the longest to get any full version of virtualbox and vmware workstation or vmware player to operate within a winpe environment.

 

honestly this is my ideal system.  i want to be able to use all my memory and hardware for certain virtual machines that I have that are real system clones without the backing of any windows operating system other than pe.  flat boot pe from hard drive, then load virtual machine interface and machines as needed.



#7 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 15 December 2018 - 05:10 PM

man, i have been trying for the longest to get any full version of virtualbox and vmware workstation or vmware player to operate within a winpe environment.

https://preview.tinyurl.com/y98ec9b2

 

:duff:

Wonko



#8 stayboogy

stayboogy

    Member

  • Members
  • 49 posts
  •  
    United States

Posted 22 December 2018 - 04:10 AM

 

that thread is a year old with no further additions?



#9 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 22 December 2018 - 01:35 PM

that thread is a year old with no further additions?

Seemingly yes, actually almost two years old.

 

What gives? :dubbio:

 

 

:duff:

Wonko



#10 RoyM

RoyM

    Frequent Member

  • .script developer
  • 420 posts
  • Interests:"Booting and Owning".
  •  
    United States

Posted 23 December 2018 - 01:14 AM

These are my notes from running a Portable VBox in a WinPE Environment.

Notes: I ran Portable-VirtualBox Starter as a Portable App.
       Not from within boot.wim, but as intended, "Portable".
 
These files are from above tinyurl.
Portable-VirtualBox_v5.1.22-Starter_v6.4.10-Win_all.exe will extract all files.
Portable-VirtualBox.exe will be in extract folder.
Also see ReadMe.txt
 
Portable-VirtualBox Starter is a wrapper for vbox.
("Use" DRIVE:\PortableApps\Portable-VirtualBox\ as default folder)
  And All vbox info's are stored at default folder\..\..
 
I downloaded newest VirtualBox-5.2.22-126460-Win.exe,
and used starter to extract x86 or x64 to default
Restart starter, it will load vbox as a 'semi'-portable. <-- NOTES LATER
 
For testing:
NOT SELECTED= Network, USB, Audio, Serial, Shared.
SELECTED==    Enable I/O APIC, VT-x/AMD-V, Nested Paging, PAE/NX, Hyper-V Para
DISPLAY==     32mb
STORAGE==     SATA/AHCI --> WinPE.iso
BASE MEM=     2048
Chipset==     ICH9
ran on this hardware
Test Setup= Toshiba Satellite C655D-S5518 w/6G Ram, 1T SSD, Booting Grub4Dos --> Win10PESE_x64.iso== 2.25G
And This=   MSI GE60 w/8G Full Install Win10x64 + Same booted to USB-->G4D-->Win10PESE, and then Portable-VirtualBox.exe.

[NOTES]
In Full install and PE, there were multiple 'vbox' registry entries left-over after exit.

 

Attached File  Win10PESE_x64_VboxPortable.gif   220.69KB   0 downloads

Attached File  Win10PESE_x64_VboxPortable-Win7PESE1.gif   192.08KB   0 downloads

Attached File  Win10PESE_x64_VboxPortable-Win7PESE2.gif   190.96KB   0 downloads

 







Also tagged with one or more of these keywords: winpe, virtual, pxe, hyperv host

3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users