Initializing the Temp Drive on Azure v6 VM SKUs (NVMe) with Nerdio

With the introduction of Azure v6 VM SKUs—that is, all virtual machines using NVMe‑based temporary storage—Microsoft changed the behavior of the temporary disk. Unlike previous VM generations, the temp drive is no longer automatically formatted and initialized. This new behavior is documented by Microsoft here:
https://learn.microsoft.com/en-us/azure/virtual-machines/enable-nvme-temp-faqs

Especially in Azure Virtual Desktop (AVD) environments, this can lead to issues. Many configurations assume that drive D: is available immediately after startup—for example for the pagefile, temporary data, or caching mechanisms. With v6 VMs, however, this is no longer guaranteed.

What happens if the pagefile is configured but the temp drive is missing?

In short:

  • Windows cannot apply the pagefile configuration on D:
  • An emergency pagefile is created on C:—or, in the worst case, none at all
  • In AVD environments, this results in performance issues and unstable sessions

This is exactly why the temp drive must be reliably available before Windows memory management applies its configuration.

How I arrived at the solution

My fellow MVP colleague Julian Mooren pointed out this changed behavior to me and developed a PowerShell script that reliably initializes the temp drive on NVMe‑based v6 VMs. His blog post explains the technical background and details in depth.

In this article, my focus is less on the script itself and more on the question:

➡️ How can this logic be cleanly and reliably integrated into Nerdio Manager for Enterprise (NME)?

Why not Nerdio Scripted Actions?

Nerdio Scripted Actions are a powerful tool, but only partially suitable for this scenario:

  • Scripted Actions are not executed automatically on every VM boot, they are delivered as a Custom Script Extension and then executed on the session host
  • Running them at every startup would be too slow and would delay the boot process

In addition, the temp drive is recreated on every VM start, not in the golden image. Configuring this in the image therefore does not solve the problem.

Because the temp drive must be initialized on every single boot, a different approach was required.

Solution: Using a Nerdio Shell App

Instead of a Scripted Action, I implemented a Nerdio Shell App. A Shell App allows the required resources and configurations to be deployed and configured on the session host during provisioning.

This makes it possible to set up a scheduled task on the session host that runs the script at every startup. Since the script is already present on the session host, no Custom Script Extension needs to be executed anymore.

The Shell App consists of four parts:

  1. Detection Script
    Checks whether the temp‑drive initialization is already installed.
  2. Install Script
    Copies the main script to the session host and configures a scheduled task.
  3. Uninstall Script
    Formally included, but largely irrelevant in AVD environments, as session hosts are typically redeployed rather than having Shell Apps “uninstalled”.
  4. Main Script
    The initialization and self‑healing script is based on Julian’s solution and has been slightly adapted.

The complete code is publicly available here: https://github.com/alphasteff/nerdio-scripted-actions-public/tree/2dddedc21fb8e320559bc3fd4382d8cea3bc5ccb/shellapps-scripts/Self-Healing%20Pagefile

My enhancements to the script

I extended and adapted the script in several areas so that I can also use it with my customers (I use a different deployment method):

  • Renamed the error switch to -IsError
  • Added a warning level using -IsWarning
  • New log path:
    C:\Windows\Logs\AVDPagefileSetup\
  • Updated deployment check from CSECompleted to DeploymentCompleted
  • Expanded service handling:
    • Validation whether services exist
    • Handling of Disabled / Manual / Automatic states
    • Improved and more transparent logging
  • Security hardening of the temp drive:
    • Removal of Users and Authenticated Users permissions on D:
  • More robust initialization of marker values when entries are missing
  • Moving the stopping of certain services earlier to avoid race conditions during initialization

Most important enhancement

➡️ Users no longer have write permissions on the temp drive.

This significantly improves security and reduces the risk of misuse or unintended write access to the NVMe‑based temp drive.

I have also shared my changes with Julian so they can be incorporated into his original solution.

Why this is especially relevant for AVD

In AVD environments, consistency and predictability are key. The temp drive:

  • Is recreated on every VM start
  • Must be available early in the boot process
  • Is often used for pagefiles and performance optimizations
  • Must not contain insecure default permissions

By combining a Nerdio Shell App with the enhanced initialization script, the following is ensured:

✅reliable temp‑drive initialization
✅clean and secure permissions
✅stable pagefile configuration
✅automatic self‑healing at every startup
✅consistent behavior across all session hosts

Fazit

Azure v6 VM SKUs provide significant performance benefits thanks to NVMe storage—but they also require new operational concepts. Automatic initialization of the temp drive is no longer optional; it is a mandatory prerequisite for stable AVD environments.

Using a Nerdio Shell App together with a robust initialization script allows this behavior to be implemented in a clean, secure, and fully automated way.

➡️ Anyone running AVD on v6 VMs should plan for this solution from the start.