- Autounattend files moved to Autounattend folder - WDAC files moved to WDAC folder - Added WDAC check to setupScript - Moved RDP to setupRDP - Moved Activate to setupActivate - Added online setup of Office with offline fallback - Changed setupUsers to be more standard and allow customisation - Added rastop setup
162 lines
6.3 KiB
PowerShell
162 lines
6.3 KiB
PowerShell
function InstallMsi {
|
|
param (
|
|
[string] $app
|
|
)
|
|
Write-Host "Installing $app..."
|
|
$msiFilePath = Join-Path -Path $tmpPath -ChildPath $app
|
|
Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$msiFilePath`" /qn" -Wait
|
|
}
|
|
|
|
function InstallExeSetup {
|
|
param (
|
|
[string] $app,
|
|
[string] $skipIf
|
|
)
|
|
Write-Host "Installing $app..."
|
|
if (-not (Test-Path -Path $skipIf -PathType Container)) {
|
|
Start-Process -FilePath $(Join-Path $tmpPath $app) -ArgumentList "/allusers /s" -Wait
|
|
} else {
|
|
Write-Host "$app already installed."
|
|
}
|
|
}
|
|
|
|
function InstallExe {
|
|
param (
|
|
[string] $app
|
|
)
|
|
$appName = [System.IO.Path]::GetFileNameWithoutExtension($app)
|
|
Write-Host "Installing $appName..."
|
|
$targetPath = Join-Path $env:ProgramFiles $appName
|
|
if (-not (Test-Path -Path $targetPath -PathType Container)) {
|
|
New-Item -Path $targetPath -ItemType Directory
|
|
}
|
|
Copy-Item -Path (Join-Path $tmpPath $app) -Destination $targetPath -Force
|
|
CreateShortcut -exe (Join-Path $targetPath $app) -app $appName
|
|
}
|
|
|
|
function InstallZipSetup {
|
|
param (
|
|
[string] $zip,
|
|
[string] $exe,
|
|
[bool] $createSubfolder = $false
|
|
)
|
|
$zipName = [System.IO.Path]::GetFileNameWithoutExtension($zip)
|
|
Write-Host "Installing $zipName..."
|
|
$expPath = Join-Path $tmpPath
|
|
if ($createSubfolder) {
|
|
$expPath = Join-Path $expPath $zipName
|
|
}
|
|
Expand-Archive -Path (Join-Path $tmpPath $zip) -DestinationPath $expPath -Force
|
|
Start-Process -FilePath $(Join-Path -Path $tmpPath -ChildPath (Join-Path -Path $zipName -ChildPath $exe)) -ArgumentList "/allusers /s" -Wait
|
|
}
|
|
|
|
function InstallZipMsi {
|
|
param (
|
|
[string] $zip,
|
|
[string] $msi
|
|
)
|
|
$zipName = [System.IO.Path]::GetFileNameWithoutExtension($zip)
|
|
Write-Host "Installing $zipName..."
|
|
$msiFilePath = Join-Path $tmpPath $(Join-Path $zipName $msi)
|
|
Expand-Archive -Path (Join-Path $tmpPath $zip) -DestinationPath $tmpPath -Force
|
|
Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$msiFilePath`" /qb" -Wait
|
|
}
|
|
|
|
function InstallZip {
|
|
param (
|
|
[string] $zip,
|
|
[string] $exe,
|
|
[string] $app,
|
|
[bool] $createSubfolder = $false
|
|
)
|
|
$zipName = [System.IO.Path]::GetFileNameWithoutExtension($zip)
|
|
Write-Host "Installing $zipName..."
|
|
$targetPath = $env:ProgramFiles
|
|
if ($createSubfolder) {
|
|
$subFolder = Join-Path $env:ProgramFiles $zipName
|
|
if (-not (Test-Path -Path $subFolder -PathType Container)) {
|
|
New-Item -Path $subFolder -ItemType Directory
|
|
}
|
|
$targetPath = $subFolder
|
|
}
|
|
if (Test-Path -Path (Join-Path $targetPath $app) -PathType Container) {
|
|
Remove-Item -Path (Join-Path $targetPath $app) -Recurse -Force
|
|
}
|
|
Expand-Archive -Path (Join-Path $tmpPath $zip) -DestinationPath $targetPath -Force
|
|
if (-not $zipName.Equals($app) -and (-not (Test-Path -Path (Join-Path $targetPath $app) -PathType Container))) {
|
|
Start-Sleep -s 2
|
|
Move-Item -Path (Join-Path $env:ProgramFiles $zipName) -Destination (Join-Path $env:ProgramFiles $app)
|
|
}
|
|
CreateShortcut -exe $(Join-Path -Path $env:ProgramFiles -ChildPath (Join-Path -Path $app -ChildPath $exe)) -app $app
|
|
}
|
|
|
|
function CreateShortcut {
|
|
param (
|
|
[string] $exe,
|
|
[string] $app
|
|
)
|
|
$shell = New-Object -ComObject WScript.Shell
|
|
$shortcut = $shell.CreateShortcut($(Join-Path $env:PUBLIC "Desktop\$app.lnk"))
|
|
$shortcut.TargetPath = $exe
|
|
$shortcut.IconLocation = $exe
|
|
$shortcut.WorkingDirectory = (Get-Item $exe).DirectoryName
|
|
$shortcut.Save()
|
|
}
|
|
|
|
function CreateURLShortcut {
|
|
param (
|
|
[string] $ShortcutName,
|
|
[string] $TargetUrl
|
|
)
|
|
|
|
$wshShell = New-Object -ComObject "WScript.Shell"
|
|
$shortcutPath = Join-Path $env:PUBLIC "Desktop\$ShortcutName.url"
|
|
|
|
$urlShortcut = $wshShell.CreateShortcut($shortcutPath)
|
|
$urlShortcut.TargetPath = $TargetUrl
|
|
$urlShortcut.Save()
|
|
}
|
|
|
|
function InstallApps {
|
|
param (
|
|
[string] $Type
|
|
)
|
|
|
|
switch ($Type) {
|
|
"Labo" {
|
|
InstallExeSetup -app "winstars_installer.exe" -skipIf "C:\Program Files\WinStars3"
|
|
InstallZip -zip "Tectoglob3D-win32-ia32.zip" -exe "Tectoglob3D.exe" -app "Tectoglob3D"
|
|
InstallZip -zip "Tectoglob_11_complet.zip" -exe "TectoGlob.exe" -app "TectoGlob"
|
|
InstallZip -zip "Sismolog.zip" -exe "Sismolog.exe" -app "Sismolog"
|
|
InstallExe -app "Respipoisson.exe"
|
|
InstallMsi -app "regressi-mpeg-setup.msi"
|
|
if (Test-Path 'C:\Users\Admin\AppData\Roaming\Microsoft\Start Menu\Programs\Regressi.ink') {
|
|
Move-Item -Path 'C:\Users\Admin\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Regressi.lnk' -Destination 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\' -Force
|
|
}
|
|
InstallZip -zip "regavi.zip" -exe "regavi.exe" -app "regavi" -createSubfolder $true
|
|
InstallExe -app "Radiochr.exe"
|
|
InstallZip -zip "Phylogene-Lycee-2021.zip" -exe "Programmes\Phylo.exe" -app "Phylogene"
|
|
InstallZip -zip "paleoterre_el32.zip" -exe "paleoTerre.exe" -app "PaleoTerre"
|
|
InstallExeSetup -app "Eduanat2_Setup_2.0.0.exe" -skipIf "C:\Program Files (x86)\Eduanat2"
|
|
InstallExe -app "Couvac.exe"
|
|
InstallZipMsi -zip "ChemSketch.zip" -msi "script.msi"
|
|
InstallZipMsi -zip "Anagene.zip" -msi "Anagene.msi"
|
|
InstallZip -zip "EduPython.zip" -exe "EduPython.exe" -app "EduPython"
|
|
InstallZip -zip "rastop.zip" -exe "RasTop.exe" -app "RasTop"
|
|
}
|
|
"Info" {
|
|
InstallMsi -app "EV3_Classroom_Windows_1.5.3_Global.msi"
|
|
InstallZip -zip "simulation.zip" -exe "simulation.exe" -app "Simulation Domotique"
|
|
InstallZip -zip "RobotProg.zip" -exe "RobotProg.exe" -app "RobotProg"
|
|
|
|
CreateURLShortcut -ShortcutName "Office 365" -TargetUrl "https://office.com/"
|
|
CreateURLShortcut -ShortcutName "Ecole Direct" -TargetUrl "https://ecoledirecte.com/"
|
|
CreateURLShortcut -ShortcutName "PIX" -TargetUrl "https://pix.fr/"
|
|
CreateURLShortcut -ShortcutName "Framindmap" -TargetUrl "https://framindmap.org/"
|
|
}
|
|
"Laptop" {
|
|
Write-Host "Nothing to install."
|
|
}
|
|
default { Write-Host "Invalid selection." }
|
|
}
|
|
} |