From 374a23f8fddf87a5c422820d6ea89c24fc57f886 Mon Sep 17 00:00:00 2001 From: Lightemerald Date: Tue, 10 Oct 2023 14:13:42 +0000 Subject: [PATCH] Update setupScriptInfo.ps1 --- setupScriptInfo.ps1 | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/setupScriptInfo.ps1 b/setupScriptInfo.ps1 index 5913a63..4106ce8 100644 --- a/setupScriptInfo.ps1 +++ b/setupScriptInfo.ps1 @@ -1,10 +1,27 @@ -$tmpPath = "C:\tmp" +#Download temp files +$tmpPath = Join-Path $env:LOCALAPPDATA "Temp" -if (-not (Test-Path -Path $tmpPath -PathType Container)) { - New-Item -Path $tmpPath -ItemType Directory - Invoke-WebRequest -URI "https://education.lego.com/_/downloads/EV3_Classroom_Windows_1.5.3_Global.msi" -OutFile "C:\tmp\EV3_Classroom_Windows_1.5.3_Global.msi" - Invoke-WebRequest -URI "https://cdn.discordapp.com/attachments/704760633379389533/1161288505390026772/simulation.zip" -OutFile "C:\tmp\simulation.zip" - Invoke-WebRequest -URI "https://cdn.discordapp.com/attachments/704760633379389533/1161288504765059172/RobotProg.zip" -OutFile "C:\tmp\RobotProg.zip" +$filesToDownload = @( + @{ + Url = "https://education.lego.com/_/downloads/EV3_Classroom_Windows_1.5.3_Global.msi" + FileName = "EV3_Classroom_Windows_1.5.3_Global.msi" + }, + @{ + Url = "https://cdn.discordapp.com/attachments/704760633379389533/1161288505390026772/simulation.zip" + FileName = "Simulation Domotique.zip" + }, + @{ + Url = "https://cdn.discordapp.com/attachments/704760633379389533/1161288504765059172/RobotProg.zip" + FileName = "RobotProg.zip" + } +) + +foreach ($fileInfo in $filesToDownload) { + $filePath = Join-Path $tmpPath $fileInfo.FileName + + if (-not (Test-Path -Path $filePath -PathType Leaf)) { + Invoke-WebRequest -Uri $fileInfo.Url -OutFile $filePath + } } Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) @@ -130,7 +147,7 @@ choco install audacity -y choco install scratch -y choco install mblock -y -Expand-Archive -Path "C:\tmp\simulation.zip" -DestinationPath "C:\Program Files\Simulation Domotique" -Force +Expand-Archive -Path "C:\tmp\Simulation Domotique.zip" -DestinationPath "C:\Program Files\" -Force $targetExePath = "C:\Program Files\Simulation Domotique\simulation.exe" $shortcutPath = "C:\Users\Public\Desktop\Simulation Domotique.lnk" $shell = New-Object -ComObject WScript.Shell @@ -142,7 +159,7 @@ $shortcut.Save() choco install arduino -y choco install ganttproject -y Start-Process -FilePath "msiexec.exe" -ArgumentList "/i C:\tmp\EV3_Classroom_Windows_1.5.3_Global.msi /qn" -Wait -Expand-Archive -Path "C:\tmp\RobotProg.zip" -DestinationPath "C:\Program Files\RobotProg" -Force +Expand-Archive -Path "C:\tmp\RobotProg.zip" -DestinationPath "C:\Program Files\" -Force $targetExePath = "C:\Program Files\RobotProg\RobotProg.exe" $shortcutPath = "C:\Users\Public\Desktop\RobotProg.lnk" $shell = New-Object -ComObject WScript.Shell