Skip to content

Instantly share code, notes, and snippets.

View MarcelMeurer's full-sized avatar

Marcel MarcelMeurer

View GitHub Profile
<#
.SYNOPSIS
Converts an Azure Gen1 (V1) Windows VM to a Gen2 (V2) VM by imaging the OS to a new V2 disk,
swapping the OS disk, and verifying the new VM boots fully into Windows before cleanup.
Provided by John Marcum - https://x.com/PJ_Marcum
.DESCRIPTION
High-level flow (orchestrated from the host):
1) Build a temporary helper VM (Gen2) in the same RG/subnet as the source.
2) Create two migration artifacts from the source OS disk:
param(
[string] $Mode
)
Add-Type -Language CSharp -TypeDefinition @'
using System;
using System.Linq;
using System.Runtime.InteropServices;
using System.Collections.Generic;
namespace Rds {
@MarcelMeurer
MarcelMeurer / Create-V2-From-V1-VM.ps1
Last active September 8, 2025 14:46
Create a Azure VM Genertation V2 from an existing V1 virtual machine (opt. including Trusted launch, secure boot, and vTPM)
param(
[ValidateNotNullOrEmpty()]
[ValidateSet('Default', 'StartInternalTask-1', 'StartInternalTask-2', 'StartInternalTask-3', 'CheckInternalTask')]
[string] $mode = "Default"
)
$ErrorActionPreference = "Stop"
#region Configuration
@MarcelMeurer
MarcelMeurer / gist:1d5ea8177ac6d82b0f9f7e08dac40621
Created March 26, 2023 16:58
Hydra-Script: Install applications from a file share (example)
# Script framework to install applications from a folder.
# Name of your installation
$name="Remote Desktop Client"
# Path of the application installation folder, including the executable of the installer (or ps1. or MSI)
$installer="\\wvduserdata.file.core.windows.net\apps-2-install\MSRDC-AVD-Client\Deploy-Application.exe"
# Parameter needed for an application (only for exe or ps1 files)
$parameters="Install"