From f8c11d5f037a9d064e607608849fcc893cf9a4d8 Mon Sep 17 00:00:00 2001 From: Lightemerald Date: Mon, 6 Nov 2023 09:39:45 +0100 Subject: [PATCH] Reworked Office setup --- setupOffice.ps1 | 8 ++++++-- setupScript.ps1 | 23 ++++++++++++++++++++++- setupTmp.ps1 | 8 ++++++++ 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/setupOffice.ps1 b/setupOffice.ps1 index fd0ce13..932200c 100644 --- a/setupOffice.ps1 +++ b/setupOffice.ps1 @@ -1,3 +1,6 @@ +$DownloadFilesURL = 'https://git.justw.tf/Lightemerald/setup-script/raw/branch/main/setupTmp.ps1' +Invoke-Expression -Command (Invoke-WebRequest -Uri $DownloadFilesURL).Content + function CheckOfficeInstall { $officeRegistryPath = "HKLM:\SOFTWARE\Microsoft\Office\ClickToRun" if (Test-Path -Path $officeRegistryPath) { @@ -23,14 +26,15 @@ function CheckOfficeInstall { } function InstallOffice { + DownloadFiles -Type "Office" $imagePath = Join-Path $tmpPath "O365ProPlusRetail.img" - $setupPath = Join-Path $driveLetter '\Office\Setup64.exe' Write-Host "Starting Microsoft Office Installation..." - if (Test-Path -Path $imagePath -PathType Leaf -and Test-Path -Path $setupPath -PathType Leaf) { + if (Test-Path -Path $imagePath -PathType Leaf) { $mountResult = Mount-DiskImage -ImagePath $imagePath -PassThru $driveLetter = ($mountResult | Get-Volume).DriveLetter + $setupPath = Join-Path $driveLetter "\Office\Setup64.exe" Start-Process -FilePath $setupPath -Wait } else { Write-Host "Office setup files not found." diff --git a/setupScript.ps1 b/setupScript.ps1 index 4e0ce1c..d7adfdb 100644 --- a/setupScript.ps1 +++ b/setupScript.ps1 @@ -119,11 +119,32 @@ function SetupCustom { ) Write-Host "Performing Custom Installation..." if ($DownloadFiles) { - DownloadFiles -Files $DownloadFiles + DownloadFiles -Type "Custom" -Files $DownloadFiles } if ($Office) { CheckOfficeInstall } + if ($Users) { + SetupUsers + if ($EleveReg) { + SetupEleveReg -username "Eleve" + } + } + if ($RDP) { + EnableRDP + } + if ($Choco) { + InstallChoco + if ($ChocoApps) { + ChocoInstallApps -Type "Custom" -Apps $ChocoApps + } + } + if ($Apps) { + InstallApps -Type "Custom" -Apps $Apps + } + if ($Update) { + UpdateWindows + } } function Show-InstallationMenu { diff --git a/setupTmp.ps1 b/setupTmp.ps1 index 642f335..1e1438b 100644 --- a/setupTmp.ps1 +++ b/setupTmp.ps1 @@ -94,6 +94,14 @@ function DownloadFiles { } ) } + "Office" { + $filesToDownload = @( + @{ + Url = "https://officecdn.microsoft.com/db/492350f6-3a01-4f97-b9c0-c7c6ddf67d60/media/fr-fr/O365ProPlusRetail.img" + FileName = "O365ProPlusRetail.img" + } + ) + } default { Write-Host "Invalid selection." } } foreach ($fileInfo in $filesToDownload) {