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 {
$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."