#(#) das ist eine Kommentarzeile
# Copy&Paste für die Befehlszeilen aus c't 15/13, S. 168
# Team-Work, Virtuelle Maschinen mit Windows Hyper-V Server 2012 replizieren

## auf dem/n Servern mit den VMs

# Konfiguration anpassen
cscript hvremote.wsf /add:vmadmin

# Stammzertifikat erstellen
makecert -pe -n "CN=hyperv1RootCA" -ss root -sr LocalMachine -sky signature -r "hyperv1RootCA.cer"

# Zertifikat für Replikation erstellen
makecert -pe -n "CN=hyperv1" -ss my -sr LocalMachine -sky exchange -eku 1.3.6.1.5.5.7.3.1,1.3.6.1.5.5.7.3.2 -in "hyperv1RootCA" -is root -ir LocalMachine -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12 hyperv1Cert.cer

# Stammzertifikat auf dem anderen/zweiten Server importieren
certutil -addstore -f Root "hyperv1RootCA.cer"

# Firewall für Replikation öffnen
netsh advfirewall firewall set rule group="Hyper-V-Replikat - HTTPS" new enable=yes

# Zugriffe auf Ereignisprotokoll gestatten
netsh advfirewall firewall set rule group="Remote-Ereignisprotokollverwaltung" new enable=yes

# Verzicht auf Widerruf
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\Replication" /v DisableCertRevocationCheck /d 1 /t REG_DWORD /f

## auf dem zur Verwaltung benutzen System

# anonyme DCOM-Zugriffe erlauben
cscript hvremote.wsf /anondcom:grant

# Passwort/Account für Administration hinterlegen
cmdkey /add:hyperv1 /user:hyperv1\vmadmin /pass



