From 97ab4215bb28e931439549797eb8b411919d4069 Mon Sep 17 00:00:00 2001 From: "manuel.maier" Date: Wed, 28 Jan 2026 00:17:50 +0100 Subject: [PATCH] install-pcvisit-remotehost.sh aktualisiert --- install-pcvisit-remotehost.sh | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/install-pcvisit-remotehost.sh b/install-pcvisit-remotehost.sh index 01234ad..d551c5a 100644 --- a/install-pcvisit-remotehost.sh +++ b/install-pcvisit-remotehost.sh @@ -5,7 +5,6 @@ # Enter = alle, oder Index-Zahlen wie 0 2 3 # ===================================================== -# ---- Farben / Layout ---- BOLD="\033[1m" GREEN="\033[32m" YELLOW="\033[33m" @@ -22,16 +21,29 @@ if [[ $EUID -ne 0 ]]; then exit 1 fi -# ---- Alle Windows VMs abfragen ---- +# ---- Alle VMs abfragen und nur Windows filtern ---- echo -e "${CYAN}${BOLD}${INDENT}Lese alle Windows VMs aus...${RESET}" -mapfile -t WINDOWS_VMS < <(qm list | awk 'NR>1 {print $1, $2}') + +WINDOWS_VMS=() +mapfile -t ALL_VMS < <(qm list | awk 'NR>1 {print $1, $2}') + +for vm in "${ALL_VMS[@]}"; do + VMID=$(echo $vm | awk '{print $1}') + VMNAME=$(echo $vm | awk '{print $2}') + + OSTYPE=$(qm config "$VMID" 2>/dev/null | grep -i "^ostype:" | awk '{print $2}') + # Prüfen, ob ostype mit "win" beginnt + if [[ "$OSTYPE" =~ ^win ]]; then + WINDOWS_VMS+=("$VMID $VMNAME") + fi +done if [ ${#WINDOWS_VMS[@]} -eq 0 ]; then echo -e "${YELLOW}${INDENT}Keine Windows VMs gefunden.${RESET}" exit 1 fi -# ---- Gefundene VMs anzeigen ---- +# ---- Gefundene Windows VMs anzeigen ---- echo -e "${CYAN}${BOLD}${INDENT}Gefundene Windows VMs:${RESET}" for i in "${!WINDOWS_VMS[@]}"; do echo -e "${INDENT}[${YELLOW}$i${RESET}] ${WINDOWS_VMS[$i]}" @@ -74,4 +86,4 @@ for vm in "${SELECTED[@]}"; do echo -e "${GREEN}${INDENT} -> Fertig mit VMID $VMID ($VMNAME)!${RESET}" done -echo -e "\n${GREEN}${BOLD}${INDENT}✅ Installation auf allen ausgewählten VMs abgeschlossen!${RESET}" +echo -e "\n${GREEN}${BOLD}${INDENT}✅ Installation auf allen ausgewählten Windows-VMs abgeschlossen!${RESET}"