Untitled

 avatar
unknown
plain_text
a month ago
1.6 kB
4
Indexable
# Variables
$SharedFolder = "\\DC01\netlogon"
$ExeName = "Setup ZEDFREE 2025.1 x64.exe"
$LocalFolder = "C:\Temp\ZEDFREE_Install"
$ZEDInstallPath = "C:\Program Files\ZEDFREE\ZEDFREE.exe" #FIXME

# Vérifier si ZEDFREE est déjà installé
if(Test-Path $ZEDInstallPath) {
    Write-Output "ZEDFREE est déjà installé sur ce poste. Installation ignorée."
    exit 0
}

# Alternative : vérifier via le registre
$ZEDRegistry = Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | 
    Where-Object {$_.DisplayName -like "*ZEDFREE*"}
if($ZEDRegistry) {
    Write-Output "ZEDFREE est déjà installé (version $($ZEDRegistry.DisplayVersion)). Installation ignorée."
    exit 0
}

# Si l'application n'est pas installée, procéder à l'installation
if(Test-Path "$SharedFolder\$ExeName"){
    # Créer le dossier temporaire en local et copier l'exécutable
    New-Item -ItemType Directory -Path "$LocalFolder" -ErrorAction SilentlyContinue
    Copy-Item "$SharedFolder\$ExeName" "$LocalFolder" -Force
    
    # Si l'exécutable est bien copié, lancer l'installation silencieuse
    if(Test-Path "$LocalFolder\$ExeName"){
        Start-Process -Wait -FilePath "$LocalFolder\$ExeName" -ArgumentList "/L1033 /S/v/qn /V`"/qn`""
        
        # Nettoyer après installation
        Remove-Item "$LocalFolder" -Recurse -Force
        
        # Vérifier si l'installation a réussi
        if(Test-Path $ZEDInstallPath) {
            Write-Output "ZEDFREE installé avec succès."
        } else {
            Write-Error "L'installation de ZEDFREE a échoué."
        }
    }
}
Editor is loading...
Leave a Comment