Reworked Office setup

This commit is contained in:
2023-11-06 09:39:45 +01:00
parent 50cdda2a3d
commit f8c11d5f03
3 changed files with 36 additions and 3 deletions

View File

@@ -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 { function CheckOfficeInstall {
$officeRegistryPath = "HKLM:\SOFTWARE\Microsoft\Office\ClickToRun" $officeRegistryPath = "HKLM:\SOFTWARE\Microsoft\Office\ClickToRun"
if (Test-Path -Path $officeRegistryPath) { if (Test-Path -Path $officeRegistryPath) {
@@ -23,14 +26,15 @@ function CheckOfficeInstall {
} }
function InstallOffice { function InstallOffice {
DownloadFiles -Type "Office"
$imagePath = Join-Path $tmpPath "O365ProPlusRetail.img" $imagePath = Join-Path $tmpPath "O365ProPlusRetail.img"
$setupPath = Join-Path $driveLetter '\Office\Setup64.exe'
Write-Host "Starting Microsoft Office Installation..." 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 $mountResult = Mount-DiskImage -ImagePath $imagePath -PassThru
$driveLetter = ($mountResult | Get-Volume).DriveLetter $driveLetter = ($mountResult | Get-Volume).DriveLetter
$setupPath = Join-Path $driveLetter "\Office\Setup64.exe"
Start-Process -FilePath $setupPath -Wait Start-Process -FilePath $setupPath -Wait
} else { } else {
Write-Host "Office setup files not found." Write-Host "Office setup files not found."

View File

@@ -119,11 +119,32 @@ function SetupCustom {
) )
Write-Host "Performing Custom Installation..." Write-Host "Performing Custom Installation..."
if ($DownloadFiles) { if ($DownloadFiles) {
DownloadFiles -Files $DownloadFiles DownloadFiles -Type "Custom" -Files $DownloadFiles
} }
if ($Office) { if ($Office) {
CheckOfficeInstall 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 { function Show-InstallationMenu {

View File

@@ -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." } default { Write-Host "Invalid selection." }
} }
foreach ($fileInfo in $filesToDownload) { foreach ($fileInfo in $filesToDownload) {