# Module laden Import-Module ImportExcel # Excel-Datei einlesen $excelPath = "C:\Pfad\zu\esx_config.xlsx" $hosts = Import-Excel -Path $excelPath -WorksheetName "Tabelle1" # Zielverzeichnis für die Kickstart-Dateien $outputDir = "C:\Kickstart-Files" New-Item -ItemType Directory -Path $outputDir -Force | Out-Null # Für jeden Host eine Kickstart-Datei generieren foreach ($host in $hosts) { $hostname = $host.Hostname $fqdn = $host.FQDN $ip = $host."Mgmt Net IP" $netmask = $host."Mgnt Netmask" $gateway = $host."vSan GW" $rootPassword = $host."root PW" $vsanIp = $host."vSan IP" $vsanNetmask = $host."vSAN Netmask" $vsanGateway = $host."vSan GW" # Kickstart-Inhalt $kickstart = @" vmaccepteula rootpw $rootPassword install --firstdisk --overwritevmfs network --bootproto=static --device=vmnic0 --ip=$ip --netmask=$netmask --gateway=$gateway --hostname=$hostname reboot %post --interpreter=busybox # Nach der Installation auszuführende VSAN-Netzwerkkonfiguration esxcli network ip interface add --interface-name=vmk1 --portgroup-name=vSAN esxcli network ip interface ipv4 set --interface-name=vmk1 -I $vsanIp -N $vsanNetmask -g $vsanGateway --type=static %end "@ # Datei speichern $filePath = Join-Path -Path $outputDir -ChildPath "$hostname-ks.cfg" $kickstart | Out-File -FilePath $filePath -Encoding UTF8 Write-Host "Kickstart-Datei für $hostname erstellt: $filePath" }