#!/usr/bin/env bash # # A second domain controller on Proxmox with the free Windows Server 2025 evaluation # https://www.zadran.net/guides/second-domain-controller-proxmox-windows-server-2025 # Generated from the guide, last updated 2026-10-13. # # NO WARRANTY. This script is provided as is. You are responsible for # understanding what it does before running it, and for the consequences. # Take a backup first. See https://www.zadran.net/disclaimer # # Destructive steps are left commented out on purpose -- uncomment them # only once you have understood what they do. # # These are the guide's bash commands. Its PowerShell commands are in # https://www.zadran.net/guides/second-domain-controller-proxmox-windows-server-2025/script.ps1 set -euo pipefail # ---- Set these for your environment ---- # Host name only, max 15 characters DC2_NAME='dc2' # A free fixed IP DC2_IP='192.168.1.22' # Any free ID on that host VMID='201' # Proxmox storage for the disks STORAGE='local-lvm' BRIDGE='vmbr0' # Proxmox storage holding the ISOs ISO_STORAGE='local' # As uploaded to Proxmox WIN_ISO='windows-server-2025-eval.iso' # As uploaded to Proxmox VIRTIO_ISO='virtio-win.iso' qm create ${VMID} --name ${DC2_NAME} --ostype win11 --machine q35 --bios ovmf \ --efidisk0 ${STORAGE}:1,efitype=4m,pre-enrolled-keys=1 --tpmstate0 ${STORAGE}:1,version=v2.0 \ --cpu host --cores 2 --memory 4096 --balloon 0 --agent 1 \ --scsihw virtio-scsi-single --scsi0 ${STORAGE}:64,iothread=1,discard=on \ --net0 virtio,bridge=${BRIDGE},firewall=1 \ --ide2 ${ISO_STORAGE}:iso/${WIN_ISO},media=cdrom --ide0 ${ISO_STORAGE}:iso/${VIRTIO_ISO},media=cdrom \ --boot 'order=ide2;scsi0' qm start ${VMID} P=/opt/monitoring/prometheus/prometheus.yml mkdir -p /opt/monitoring/backup cp $P /opt/monitoring/backup/prometheus.yml.$(date +%Y%m%d-%H%M%S) sed -i "/job_name: windows/,/static_configs:/ s|static_configs:|static_configs:\n - targets: ['${DC2_IP}:9182']\n labels:\n host: ${DC2_NAME}|" $P grep -A8 'job_name: windows' $P docker exec prometheus promtool check config /etc/prometheus/prometheus.yml && curl -fsS -X POST localhost:9090/-/reload && echo reloaded