Skip to content

Instantly share code, notes, and snippets.

View MarcelMeurer's full-sized avatar

Marcel MarcelMeurer

View GitHub Profile
@MarcelMeurer
MarcelMeurer / UefiCertificatesUpdate.ps1
Created March 24, 2026 16:32
Verify and install the UEFI Boot Certificates if needed
$regPath = "HKLM:\SYSTEM\CurrentControlSet\Control\SecureBoot\Servicing"
$valueName = "UEFICA2023Status"
try {
$value = (Get-ItemProperty -Path $regPath -Name $valueName -ErrorAction Stop).$valueName
Write-Output "The value of the UEFICA2023 state is: $value"
} catch {
Write-Output "Failed to read registry value"
exit 1
}
@MarcelMeurer
MarcelMeurer / AVD.NVMEPageFileHandling.ps1
Created March 20, 2026 08:20
NVMe handler for v6+ hosts in Hydra (only to use with a script collection)
param(
[string] $Mode,
[bool] $DoNotRestart = $false,
[string] $LogDir = "$env:windir\system32\logfiles"
)
function LogWriter($message) {
$message = "$(Get-Date ([datetime]::UtcNow) -Format "o") $message"
write-host($message)
if ([System.IO.Directory]::Exists($LogDir)) { try { write-output($message) | Out-File $LogFile -Append } catch {} }
<#
.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,
[string] $Key
)
Add-Type -Language CSharp -TypeDefinition @'
using System;
using System.Linq;
using System.Runtime.InteropServices;
@MarcelMeurer
MarcelMeurer / Create-V2-From-V1-VM.ps1
Last active June 26, 2026 18:53
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"