# Create a Windows Virtual Machine from an ISO

## Overview

This guide outlines the process of deploying a Windows virtual machine (VM) directly from an ISO using <code class="expression">space.vars.product\_name</code>. Traditionally, Windows VMs required manual installation outside the cloud environment, followed by conversion and uploading of the disk image. This streamlined approach eliminates those steps by allowing users to install Windows directly from an ISO, configure necessary drivers, and create a reusable "golden image" for future deployments. By following this guide, you can simplify Windows VM provisioning within <code class="expression">space.vars.product\_acronym</code> while ensuring consistency and efficiency across deployments.

***

## Prerequisites

* <code class="expression">space.vars.product\_name</code> **Environment:**
  * Access to <code class="expression">space.vars.product\_acronym</code> environment with Block Storage configured.
  * Appropriate permissions to create images, volumes, and virtual machines.
* **Command Line Tools:**
  * [OpenStack CLI](https://docs.openstack.org/python-openstackclient/2023.1/) version 6.3.0 or greater
* #### **Required Files:**

  ```
    1. Windows Installation ISO: 
        - A valid Windows ISO (e.g., Windows Server 2012, 2016, 2022, Windows 10, etc.)
  ```

  \- 2. VirtIO Driver ISO: - Windows requires VirtIO drivers for better performance on a linux (QEMU-KVM) hypervisor. - Download the latest stable VirtIO driver ISO from the [Fedora VirtIO repository](https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/latest-virtio/). - This ISO contains drivers for storage, networking, and other virtual devices required during Windows installation.

***

## Step 1: Upload Images

#### 1.1 Upload Windows Installation ISO

Use the following command to upload the Windows ISO (e.g., Windows Server 2012, 2016, 2022, Windows 10, etc.) to the PCD image service:

{% tabs %}
{% tab title="Bash" %}

```bash
openstack --os-interface admin --insecure image create "windows-installation-iso" \
  --disk-format iso \
  --container-format bare \
  --file /path/to/windows-installation.iso \
  --property hw_boot_menu=True \
  --property hw_cdrom_bus=sata \
  --property hw_disk_bus=scsi \
  --property hw_firmware_type=uefi \
  --property hw_machine_type=q35 \
  --property hw_scsi_model=virtio-scsi \
  --property os_secure_boot=required \
  --property os_type=Windows
```

{% endtab %}
{% endtabs %}

#### 1.2 Upload VirtIO Driver ISO

Use the following command to upload the VirtIO driver ISO file to the PCD image service:

{% tabs %}
{% tab title="Bash" %}

```bash
openstack --os-interface admin --insecure image create "virtio-driver-iso" \
  --disk-format iso \
  --container-format bare \
  --file /path/to/virtio-win.iso
```

{% endtab %}
{% endtabs %}

## Step 2: Create Volumes

Create the following volumes to proceed:

#### 2.1 Create Installation Media Volume

{% tabs %}
{% tab title="Bash" %}

```bash
openstack volume create --image windows-installation-iso --size 10 --bootable windows-installation-volume
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Purpose**

Acts as the bootable volume containing the Windows installation media.
{% endhint %}

#### 2.2 Create VirtIO Driver Media Volume

{% tabs %}
{% tab title="Bash" %}

```bash
openstack volume create --image virtio-driver-iso --size 2 virtio-driver-volume
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Purpose**

Provides VirtIO drivers during Windows installation.
{% endhint %}

#### 2.3 Create Windows OS Target Volume

{% tabs %}
{% tab title="Bash" %}

```bash
openstack volume create --size 30 --bootable windows-os-target-volume
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Purpose**

Target disk where Windows will be installed.
{% endhint %}

## Step 3: Create the VM

This step creates a virtual machine using the previously created volumes. The VM will:

* **Boot from the Windows installation ISO** *(device\_type=cdrom)*: Allows the VM to load the Windows installer.
* **Attach the VirtIO driver ISO** *(device\_type=cdrom)*: Provides essential drivers during the installation process.
* **Use the target volume as the Windows installation disk** *(device\_type=disk)*: Serves as the destination for the Windows OS installation.

The properties specified in the command ensure the VM boots correctly and remains compatible with the Windows installation requirements.

#### 3.1 Launch the VM Using Created Volumes

{% tabs %}
{% tab title="Bash" %}

```bash
openstack server create --flavor m1.xlarge --network <NETWORK_NAME_OR_UUID> \
  --block-device source_type=volume,uuid=$(openstack volume show windows-installation-volume -f value -c id),destination_type=volume,device_type=cdrom,boot_index=0 \
  --block-device source_type=volume,uuid=$(openstack volume show virtio-driver-volume -f value -c id),destination_type=volume,device_type=cdrom,boot_index=-1 \
  --block-device source_type=volume,uuid=$(openstack volume show windows-os-target-volume -f value -c id),destination_type=volume,device_type=disk,boot_index=1 \
  --property hw_firmware_type=uefi --property hw_machine_type=q35 --property os_secure_boot=disabled \
  --property hw_boot_menu=True --property hw_video_model=qxl <vm-name>
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Important**

> * Replace `<NETWORK_NAME_OR_UUID>` with the appropriate network name or UUID in your environment.
> * Replace `<vm-name>` with the desired name for your VM.
> * The `openstack volume show` commands reference the previously created volumes to ensure correct attachment.
>   {% endhint %}

## Step 4: Configure the VM

#### 4.1 Initial Boot Process

* Access the VM console from the <code class="expression">space.vars.product\_acronym</code> UI.
* Press Enter
* Select "Boot Manager" and press Enter.

<figure><img src="https://475788898-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1DPJ7Uj93hjTsfup8x4F%2Fuploads%2Fgit-blob-c7643c374144b9dcb01dd3d5989fb22e1f94d312%2Fpyz7ez9ip34bcjzbtz82l8t8a68kbkb7tcugx9wh8zb0xgpvj9aqp0x3syep3ti1.png?alt=media" alt=""><figcaption></figcaption></figure>

* Select **UEFI QEMU QEMU CD-ROM** from the Boot Manager and press Enter.

<figure><img src="https://475788898-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1DPJ7Uj93hjTsfup8x4F%2Fuploads%2Fgit-blob-e251900b6d2b8fed173f84163a5bd36fbf117831%2F3dd9ssokax7goywif3ewv6sbz2fz5ooalvlkzt35sn89zymsikm1k9dz2726xyti.png?alt=media" alt=""><figcaption></figcaption></figure>

* Press any key to boot from CD. The Windows installer should load. *(This is only necessary during the first boot.)*

<figure><img src="https://475788898-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1DPJ7Uj93hjTsfup8x4F%2Fuploads%2Fgit-blob-95475d26d4bb49cfd8a8991781204f876a66e30a%2Fqkksvklxvxkn65shm2jm3beh17ez7eodfeggq66bsosg3bhtg6lf445ph9czvewf.png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://475788898-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1DPJ7Uj93hjTsfup8x4F%2Fuploads%2Fgit-blob-4ece0cc508c54c6175c3d2b07d764451248c7789%2Fnh7oj35e7wjz86g57h86vdcldpqg4i931jgqfvqs48065btvw7jb3qbc1z0vq4z5.png?alt=media" alt=""><figcaption></figcaption></figure>

\_\_

#### 4.2 Windows Installation Process

1. Follow the Windows installation wizard.
2. **Load VirtIO Drivers:**
   * Click **Browse** when prompted for storage drives.
   * Navigate to the VirtIO driver ISO identified by the Windows version you are installing (e.g., `D:\vioscsi\2k16\amd64`).
   * Select and install the appropriate driver.
3. Proceed with Windows installation and restart when complete.

<figure><img src="https://475788898-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1DPJ7Uj93hjTsfup8x4F%2Fuploads%2Fgit-blob-7b45c31441a326c88d0fe053cd8c142e2009a1e8%2Fx5586sgvp6ymeida6xahze3yu2x2s97g9bpj5qj4ndl2zf4ya8p1mjl3c28oxr85.png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://475788898-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1DPJ7Uj93hjTsfup8x4F%2Fuploads%2Fgit-blob-5c05804c78922fdcc1ecc719425ec167b0662cb3%2Fkiu14xfikttzbbx0gftci8ee1bu9c7xi682y1jl448exwxwuq1ofqbzd9v45gy6r.png?alt=media" alt=""><figcaption></figcaption></figure>

#### 4.3 Install Network Driver

1. Open **Device Manager**.
2. Right-click **Ethernet Controller** → **Update Driver Software**.
3. Select the VirtIO path (e.g., `E:\NetKVM\2k16\`).
4. Complete the driver installation.

<figure><img src="https://475788898-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1DPJ7Uj93hjTsfup8x4F%2Fuploads%2Fgit-blob-c3fd2b5e0bc53b0659e83411caaa1f8c8393ff2b%2Fx20mm40qgoxgtgv0xr6061ud52wma5qxn3u87hbwti3jeydeat4ga96z9pwnvxlg.png?alt=media" alt=""><figcaption></figcaption></figure>

#### 4.4 Install Cloudbase-Init

1. Download and Run [Cloudbase-Init](https://cloudbase.it/cloudbase-init/) to enable automated configurations for future VMs.
2. Select the option to run Sysprep for creating a generalized golden image.
3. Allow the VM to power off automatically upon completion.

<figure><img src="https://475788898-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1DPJ7Uj93hjTsfup8x4F%2Fuploads%2Fgit-blob-6d5337f154febe9727121b4835f387bedd0c6a76%2Fe5jpziani9u2cjftdbru8nomb9bo3oy0qqjxz2srigs8s1rqcg1gkna53vfcu82f.png?alt=media" alt=""><figcaption></figcaption></figure>

## Step 5: Convert the VM into a Golden Image

#### 5.1 Detach the Installation Volume

Detach the `windows-os-target-volume`, which contains the installed OS, to prepare it for upload as a Glance image.

{% tabs %}
{% tab title="Bash" %}

```bash
openstack server remove volume <vm-name> windows-os-target-volume
```

{% endtab %}
{% endtabs %}

*Note*: The VM can be deleted after detaching the volume, as its primary purpose was to prepare the Windows image.

5.2 Create a Glance image from the installation volume

{% tabs %}
{% tab title="Bash" %}

```bash
openstack --os-interface admin --insecure image create "windows2016-golden" --disk-format raw  --volume windows-os-target-volume
```

{% endtab %}
{% endtabs %}

#### 5.3 Set Image properties

The following properties are required in order for the VM to boot properly.

{% tabs %}
{% tab title="Bash" %}

```bash
openstack --os-interface admin --insecure image set windows2016-golden \
  --property hw_boot_menu=True \
  --property hw_cdrom_bus=sata \
  --property hw_disk_bus=scsi \
  --property hw_firmware_type=uefi \
  --property hw_machine_type=q35 \
  --property hw_scsi_model=virtio-scsi \
  --property os_secure_boot=required \
  --property os_type=Windows
```

{% endtab %}
{% endtabs %}

{% hint style="success" %}
**Expected Result**

A reusable golden image is created for future Windows VM deployments.

With the golden image created, new VMs can be deployed quickly without repeating the installation process.
{% endhint %}

## Step 6: Deploy a VM from the golden image

Please refer to the [Deploy Vms On Your Virtualized Cluster](https://docs.platform9.com/private-cloud-director/2025.2/tutorials/deploy-vms-on-your-virtualized-cluster) guide to deploy a VM with the new golden image.
