Showing posts with label Virtualization. Show all posts
Showing posts with label Virtualization. Show all posts

Thursday, January 20, 2022

Desktop Virtualization of Released Software using Virtual Hard Disk

Software Applications in regulated domains  use customized  OS based  on an embedded OS such as WES7 or Win10 IOT. This is for restricting access and  also to provide a highly controlled environment.

The application software installation can be time consuming as it involves first formatting and installing the OS; then installing application software. With multiple releases of the software and limited resources, installation of an older release can be painful especially if it's DVD based due to wear and tear.

A Virtual Hard Disk or  VHD is nothing but a flat file  on the disk of host PC, which can be mounted as a Hard disk on the system with multiple partitions. Further a VHD can be made bootable by adding an entry to the boot menu. A VHD can be created using DiskMgmt control panel app or using diskpart.exe.


A VHD can come very handy where OS + Application can be pre-installed on a VHD. It simply can be mounted and made bootable on demand. In other words, a single PC can run multiple installations on demand without requiring an installation. The file can be even copied and deployed on a different but compatible PC.

Example
Consider a typical software application that runs on a customized embedded OS. The volume layout can be as below.
C:  OS + Application Software
D:  Data
 
Create a VHD
A VHD can be created using DiskMgmt control panel app or diskpart.exe. The example below creates a VHD with a matching volume layout as shown above.
After running the script, the VHD can be visualized as shown above  diskmgmt.msc

Load  OS into VHD
The next step is to format the active partition on the VHD and load OS into it using imagex command
Note that H: is the system partition as shown above.  This usually loads syspreped image of the OS
imagex /apply Installer.wim 1 H:

Make VHD bootable and make it default
bcdboot h:\windows
Boot files successfully created.
bcdedit /set {default} description "Some App 1.0"
The operation completed successfully.

Reboot
After reboot a new boot menu entry is added as shown below and is automatically selected to boot from.

Load Application Software
Once OS is installed, the Application software will be loaded as a part of the installation.


Source and Binaries can be found here.


Sunday, January 9, 2022

Using bootable Virtual Hard Drive as Media instead of USB Drive/DVD Disk

Installing commercial software having embedded OS  such as WES7 or Win10IOT, uses various types of media such as CD/DVD or USB. This is mainly because of deployment of custom Operating system. These type of installations cannot be automated because of  need of manual operations such as boot options, bios password etc.
A bootable Virtual Hard Disk( VHD) provides a perfect solution. Following describes the process in detail.
1. Duplicate the USB disk image into a Virtual Hard disk. For example, The VHD contains two partitions. The first is bootable partition containing WinPE OS. The second is Service Disk containing license files.
2. Load the OS
The OS Image in an USB has following structure:
The sources folder contains the boot.wim which is loaded by the OS. However for the VHD, the entire boot.wim should be extracted into the bootable drive.
In addition, customization of the scripting may be required for correct deployment. It can be done starting with modifying windows\system32\startnet.cmd file. This script is first that is executed.

3.Adding boot entry and make it default.
The last step is to add an boot entry to the VHD file. After adding the entry system is rebooted. The system loads bootable VHD drive and loads the WinPE OS the same way in case of an USB drive.
bcdboot u:\windows
Boot files successfully created.
bcdedit /set {default} description "Some App 1.0"
The operation completed successfully.

4.Reboot the system
After the system restarts, the system will automatically select the bootable vhd to start.


Source and Binaries can be found here.