Fixing Isssues with install apps
This commit is contained in:
@@ -7,18 +7,6 @@ function InstallMsi {
|
|||||||
Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$msiFilePath`" /qn" -Wait
|
Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$msiFilePath`" /qn" -Wait
|
||||||
}
|
}
|
||||||
|
|
||||||
function InstallZipMsi {
|
|
||||||
param (
|
|
||||||
[string] $zip,
|
|
||||||
[string] $msi
|
|
||||||
)
|
|
||||||
$zipName = [System.IO.Path]::GetFileNameWithoutExtension($zip)
|
|
||||||
Write-Host "Installing $zipName..."
|
|
||||||
Expand-Archive -Path (Join-Path $tmpPath $zip) -DestinationPath (Join-Path $tmpPath $zipName) -Force
|
|
||||||
$msiFilePath = Join-Path -Path $tmpPath -ChildPath $msi
|
|
||||||
Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$msiFilePath`" /qn" -Wait
|
|
||||||
}
|
|
||||||
|
|
||||||
function InstallExeSetup {
|
function InstallExeSetup {
|
||||||
param (
|
param (
|
||||||
[string] $app
|
[string] $app
|
||||||
@@ -48,20 +36,30 @@ function InstallZipSetup {
|
|||||||
)
|
)
|
||||||
$zipName = [System.IO.Path]::GetFileNameWithoutExtension($zip)
|
$zipName = [System.IO.Path]::GetFileNameWithoutExtension($zip)
|
||||||
Write-Host "Installing $zipName..."
|
Write-Host "Installing $zipName..."
|
||||||
Expand-Archive -Path (Join-Path $tmpPath $zip) -DestinationPath $tmpPath -Force
|
$expPath = Join-Path $tmpPath $zipName
|
||||||
Start-Process -FilePath $(Join-Path -Path $tmpPath -ChildPath (Join-Path -Path $zipName -ChildPath $exe)) -ArgumentList "/allusers /s" -Wait
|
Expand-Archive -Path (Join-Path $tmpPath $zip) -DestinationPath $expPath -Force
|
||||||
|
Start-Process -FilePath $(Join-Path -Path $expPath -ChildPath (Join-Path -Path $zipName -ChildPath $exe)) -ArgumentList "/allusers /s" -Wait
|
||||||
}
|
}
|
||||||
|
|
||||||
function InstallZip {
|
function InstallZip {
|
||||||
param (
|
param (
|
||||||
[string] $zip,
|
[string] $zip,
|
||||||
[string] $exe,
|
[string] $exe,
|
||||||
[string] $app
|
[string] $app,
|
||||||
|
[bool] $createSubfolder = $false
|
||||||
)
|
)
|
||||||
$zipName = [System.IO.Path]::GetFileNameWithoutExtension($zip)
|
$zipName = [System.IO.Path]::GetFileNameWithoutExtension($zip)
|
||||||
Write-Host "Installing $zipName..."
|
Write-Host "Installing $zipName..."
|
||||||
Expand-Archive -Path (Join-Path $tmpPath $zip) -DestinationPath $env:ProgramFiles -Force
|
$targetPath = $env:ProgramFiles
|
||||||
if (-not $zipName.Equals($app)) {
|
if ($createSubfolder) {
|
||||||
|
$subFolder = Join-Path $env:ProgramFiles $zipName
|
||||||
|
if (-not (Test-Path -Path $subFolder -PathType Container)) {
|
||||||
|
New-Item -Path $subFolder -ItemType Directory
|
||||||
|
}
|
||||||
|
$targetPath = $subFolder
|
||||||
|
}
|
||||||
|
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))) {
|
||||||
Move-Item -Path (Join-Path $env:ProgramFiles $zipName) -Destination (Join-Path $env:ProgramFiles $app)
|
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
|
CreateShortcut -exe $(Join-Path -Path $env:ProgramFiles -ChildPath (Join-Path -Path $app -ChildPath $exe)) -app $app
|
||||||
@@ -107,14 +105,14 @@ function InstallApps {
|
|||||||
InstallZip -zip "Tectoglob_11_complet.zip" -exe "TectoGlob.exe" -app "TectoGlob"
|
InstallZip -zip "Tectoglob_11_complet.zip" -exe "TectoGlob.exe" -app "TectoGlob"
|
||||||
InstallExe -app "Respipoisson.exe"
|
InstallExe -app "Respipoisson.exe"
|
||||||
InstallMsi -app "regressi-mpeg-setup.msi"
|
InstallMsi -app "regressi-mpeg-setup.msi"
|
||||||
InstallZip -zip "regavi.zip" -exe "regavi.exe" -app "Regavi"
|
InstallZip -zip "regavi.zip" -exe "regavi.exe" -app "Regavi" -createSubfolder $true
|
||||||
InstallExe -app "Radiochr.exe"
|
InstallExe -app "Radiochr.exe"
|
||||||
InstallZip -zip "Phylogene-Lycee-2021.zip" -exe "Programmes\Phylo.exe" -app "Phylogene"
|
InstallZip -zip "Phylogene-Lycee-2021.zip" -exe "Programmes\Phylo.exe" -app "Phylogene"
|
||||||
InstallZip -zip "paleoterre_el32.zip" -exe "paleoTerre.exe" -app "PaleoTerre"
|
InstallZip -zip "paleoterre_el32.zip" -exe "paleoTerre.exe" -app "PaleoTerre"
|
||||||
InstallExeSetup -app "Eduanat2_Setup_2.0.0.exe"
|
InstallExeSetup -app "Eduanat2_Setup_2.0.0.exe"
|
||||||
InstallZip -zip "couvac_exe.zip" -exe "couvac.exe" -app "Couvac"
|
InstallZip -zip "couvac_exe.zip" -exe "couvac.exe" -app "Couvac" -createSubfolder $true
|
||||||
InstallZipSetup -zip "ACDLabs202311_ChemSketch_FInstall.zip" -exe "setup.exe"
|
InstallZipSetup -zip "ACDLabs202311_ChemSketch_FInstall.zip" -exe "setup.exe"
|
||||||
InstallZipMsi -zip "Anagene.zip" -msi "Anagène 2.msi"
|
InstallZipSetup -zip "Anagene.zip" -exe "Anagene/Setup.exe"
|
||||||
}
|
}
|
||||||
"Info" {
|
"Info" {
|
||||||
InstallZip -zip "simulation.zip" -exe "simulation.exe" -app "Simulation Domotique"
|
InstallZip -zip "simulation.zip" -exe "simulation.exe" -app "Simulation Domotique"
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ function InstallChoco {
|
|||||||
|
|
||||||
function ChocoInstallApps {
|
function ChocoInstallApps {
|
||||||
param (
|
param (
|
||||||
[string] $Type
|
[string] $Type,
|
||||||
|
[string] $Apps
|
||||||
)
|
)
|
||||||
|
|
||||||
switch ($Type) {
|
switch ($Type) {
|
||||||
@@ -20,7 +21,7 @@ function ChocoInstallApps {
|
|||||||
choco install audacity -y
|
choco install audacity -y
|
||||||
choco install avogadro -y
|
choco install avogadro -y
|
||||||
choco install arduino -y --install-arguments="/allusers" --force
|
choco install arduino -y --install-arguments="/allusers" --force
|
||||||
}
|
}
|
||||||
"Info" {
|
"Info" {
|
||||||
choco install dotnet -y
|
choco install dotnet -y
|
||||||
choco install vcredist-all -y
|
choco install vcredist-all -y
|
||||||
@@ -35,14 +36,19 @@ function ChocoInstallApps {
|
|||||||
choco install mblock -y
|
choco install mblock -y
|
||||||
choco install arduino -y --install-arguments="/allusers"
|
choco install arduino -y --install-arguments="/allusers"
|
||||||
choco install ganttproject -y
|
choco install ganttproject -y
|
||||||
}
|
}
|
||||||
"Laptop" {
|
"Laptop" {
|
||||||
choco install dotnet -y
|
choco install dotnet -y
|
||||||
choco install vcredist-all -y
|
choco install vcredist-all -y
|
||||||
choco install firefox -y
|
choco install firefox -y
|
||||||
choco install 7zip -y
|
choco install 7zip -y
|
||||||
choco install vlc -y
|
choco install vlc -y
|
||||||
}
|
}
|
||||||
|
"Custom" {
|
||||||
|
foreach ($app in $Apps) {
|
||||||
|
choco install $app -y
|
||||||
|
}
|
||||||
|
}
|
||||||
default { Write-Host "Invalid selection." }
|
default { Write-Host "Invalid selection." }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,9 +19,9 @@ function CheckOfficeInstall {
|
|||||||
Write-Host "Microsoft Office is not installed."
|
Write-Host "Microsoft Office is not installed."
|
||||||
InstallOffice
|
InstallOffice
|
||||||
}
|
}
|
||||||
Write-Host "Activating Windows and Office..."
|
|
||||||
$status = CheckActivation
|
$status = CheckActivation
|
||||||
if ($status -eq $false) {
|
if ($status -eq $false) {
|
||||||
|
Write-Host "Activating Windows and Office..."
|
||||||
ActivateWindowsOffice
|
ActivateWindowsOffice
|
||||||
}
|
}
|
||||||
Write-Host "Windows and Office activation complete!"
|
Write-Host "Windows and Office activation complete!"
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ function Import-ScriptsFromUrls {
|
|||||||
foreach ($url in $ScriptUrls) {
|
foreach ($url in $ScriptUrls) {
|
||||||
$fileName = Split-Path -Leaf $url
|
$fileName = Split-Path -Leaf $url
|
||||||
$localFile = Join-Path -Path $LocalPath -ChildPath $fileName
|
$localFile = Join-Path -Path $LocalPath -ChildPath $fileName
|
||||||
Write-Host "Downloading script from $url to $localFile"
|
Write-Host "Downloading script $fileName to $localFile"
|
||||||
Invoke-WebRequest -Uri $url -OutFile $localFile -UseBasicParsing
|
Invoke-WebRequest -Uri $url -OutFile $localFile -UseBasicParsing
|
||||||
Write-Host "Importing script from $localFile"
|
Write-Host "Importing script from $localFile"
|
||||||
$scripts += $localFile
|
$scripts += $localFile
|
||||||
@@ -54,42 +54,31 @@ function Setup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Custom {
|
function Custom {
|
||||||
# ask user if they need to download files
|
|
||||||
$input = Read-Host "Do you need to download files? (y/n)"
|
|
||||||
if ($input -eq "y") {
|
|
||||||
$DownloadFiles = @()
|
|
||||||
do {
|
|
||||||
$input = Read-Host "Enter the URL of the file you want to download (leave empty to stop)"
|
|
||||||
if ($input -ne "") {
|
|
||||||
$DownloadFiles += $input
|
|
||||||
}
|
|
||||||
} while ($input -ne "")
|
|
||||||
}
|
|
||||||
# ask user if they need to install office
|
|
||||||
$input = Read-Host "Do you need to install Office? (y/n)"
|
$input = Read-Host "Do you need to install Office? (y/n)"
|
||||||
if ($input -eq "y") {
|
if ($input -eq "y") {
|
||||||
$Office = $true
|
$Office = $true
|
||||||
}
|
}
|
||||||
# ask user if they need to setup users
|
|
||||||
$input = Read-Host "Do you need to setup users? (y/n)"
|
$input = Read-Host "Do you need to setup users? (y/n)"
|
||||||
if ($input -eq "y") {
|
if ($input -eq "y") {
|
||||||
$Users = $true
|
$Users = $true
|
||||||
# ask user if they need to setup eleve registry
|
|
||||||
$input = Read-Host "Do you need to setup eleve registry? (y/n)"
|
$input = Read-Host "Do you need to setup eleve registry? (y/n)"
|
||||||
if ($input -eq "y") {
|
if ($input -eq "y") {
|
||||||
$EleveReg = $true
|
$EleveReg = $true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# ask user if they need to enable RDP
|
|
||||||
$input = Read-Host "Do you need to enable RDP? (y/n)"
|
$input = Read-Host "Do you need to enable RDP? (y/n)"
|
||||||
if ($input -eq "y") {
|
if ($input -eq "y") {
|
||||||
$RDP = $true
|
$RDP = $true
|
||||||
}
|
}
|
||||||
# ask user if they need to install chocolatey
|
|
||||||
$input = Read-Host "Do you need to install chocolatey? (y/n)"
|
$input = Read-Host "Do you need to install chocolatey? (y/n)"
|
||||||
if ($input -eq "y") {
|
if ($input -eq "y") {
|
||||||
$Choco = $true
|
$Choco = $true
|
||||||
# ask user if they need to install chocolatey apps
|
|
||||||
$input = Read-Host "Do you need to install chocolatey apps? (y/n)"
|
$input = Read-Host "Do you need to install chocolatey apps? (y/n)"
|
||||||
if ($input -eq "y") {
|
if ($input -eq "y") {
|
||||||
$ChocoApps = @()
|
$ChocoApps = @()
|
||||||
@@ -101,41 +90,25 @@ function Custom {
|
|||||||
} while ($input -ne "")
|
} while ($input -ne "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# ask user if they need to install apps
|
|
||||||
$input = Read-Host "Do you need to install apps? (y/n)"
|
|
||||||
if ($input -eq "y") {
|
|
||||||
$Apps = @()
|
|
||||||
do {
|
|
||||||
$input = Read-Host "Enter the name of the app you want to install (leave empty to stop)"
|
|
||||||
if ($input -ne "") {
|
|
||||||
$Apps += $input
|
|
||||||
}
|
|
||||||
} while ($input -ne "")
|
|
||||||
}
|
|
||||||
# ask user if they need to update windows
|
|
||||||
$input = Read-Host "Do you need to update windows? (y/n)"
|
$input = Read-Host "Do you need to update windows? (y/n)"
|
||||||
if ($input -eq "y") {
|
if ($input -eq "y") {
|
||||||
$Update = $true
|
$Update = $true
|
||||||
}
|
}
|
||||||
SetupCustom -DownloadFiles $DownloadFiles -Office $Office -Users $Users -EleveReg $EleveReg -RDP $RDP -Choco $Choco -ChocoApps $ChocoApps -Apps $Apps -Update $Update
|
SetupCustom -Office $Office -Users $Users -EleveReg $EleveReg -RDP $RDP -Choco $Choco -ChocoApps $ChocoApps -Update $Update
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetupCustom {
|
function SetupCustom {
|
||||||
param (
|
param (
|
||||||
[array] $DownloadFiles,
|
|
||||||
[bool] $Office,
|
[bool] $Office,
|
||||||
[bool] $Users,
|
[bool] $Users,
|
||||||
[bool] $EleveReg,
|
[bool] $EleveReg,
|
||||||
[bool] $RDP,
|
[bool] $RDP,
|
||||||
[bool] $Choco,
|
[bool] $Choco,
|
||||||
[array] $ChocoApps,
|
[array] $ChocoApps,
|
||||||
[array] $Apps,
|
|
||||||
[bool] $Update
|
[bool] $Update
|
||||||
)
|
)
|
||||||
Write-Host "Performing Custom Installation..."
|
Write-Host "Performing Custom Installation..."
|
||||||
if ($DownloadFiles) {
|
|
||||||
DownloadFiles -Type "Custom" -Files $DownloadFiles
|
|
||||||
}
|
|
||||||
if ($Office) {
|
if ($Office) {
|
||||||
CheckOfficeInstall
|
CheckOfficeInstall
|
||||||
}
|
}
|
||||||
@@ -154,9 +127,6 @@ function SetupCustom {
|
|||||||
ChocoInstallApps -Type "Custom" -Apps $ChocoApps
|
ChocoInstallApps -Type "Custom" -Apps $ChocoApps
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($Apps) {
|
|
||||||
InstallApps -Type "Custom" -Apps $Apps
|
|
||||||
}
|
|
||||||
if ($Update) {
|
if ($Update) {
|
||||||
UpdateWindows
|
UpdateWindows
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user