improved resiliency during Office uninstall/install operations
This commit is contained in:
+151
-26
@@ -37,7 +37,7 @@ function Get-OfficeDeploymentDefinitions {
|
||||
ScrubScenarioPattern = '(?m)^\s*(\d{2}):'
|
||||
ScrubScenarioSuccess = @('00', '66', '68')
|
||||
ScrubExitSuccess = @(0, 66, 68)
|
||||
HelperVersion = 'EmberkomOfficeUserCleanup-v2'
|
||||
HelperVersion = 'EmberkomOfficeUserCleanup-v4'
|
||||
Language = 'en-us'
|
||||
OfficeBuildPattern = '^16\.0\.\d+\.\d+$'
|
||||
OdtExcludedApps = @('Groove', 'OneDrive', 'Lync', 'Teams', 'OutlookForWindows')
|
||||
@@ -68,6 +68,11 @@ function Get-OfficeDeploymentDefinitions {
|
||||
DownloadTimeoutSeconds = 300
|
||||
DownloadRetrySeconds = 3
|
||||
OdtPageTimeoutSeconds = 120
|
||||
MsiBusyAttempts = 5
|
||||
MsiBusyRetrySeconds = 15
|
||||
RegistrationCheckAttempts = 13
|
||||
RegistrationCheckSeconds = 5
|
||||
AppxRemovalAttempts = 3
|
||||
UserCleanupWaitMinutes = 5
|
||||
UserCleanupTaskMinutes = 15
|
||||
}
|
||||
@@ -163,12 +168,13 @@ function Assert-OfficeMicrosoftSignature {
|
||||
}
|
||||
|
||||
function Save-OfficeDownload {
|
||||
param([string]$Uri, [string]$Path)
|
||||
param([string]$Uri, [string]$Path, [int]$TimeoutSeconds = 0)
|
||||
$definitions = Get-OfficeDeploymentDefinitions
|
||||
if (!$TimeoutSeconds) { $TimeoutSeconds = $definitions.DownloadTimeoutSeconds }
|
||||
for ($attempt = 1; $attempt -le $definitions.DownloadAttempts; $attempt++) {
|
||||
try {
|
||||
$null = Write-Output "Download attempt ${attempt}: $Uri -> $Path"
|
||||
Invoke-WebRequest -UseBasicParsing -Uri $Uri -OutFile $Path -TimeoutSec $definitions.DownloadTimeoutSeconds -ErrorAction Stop
|
||||
Invoke-WebRequest -UseBasicParsing -Uri $Uri -OutFile $Path -TimeoutSec $TimeoutSeconds -ErrorAction Stop
|
||||
if ((Get-Item -LiteralPath $Path -ErrorAction Stop).Length -eq 0) { throw 'Download was empty.' }
|
||||
return
|
||||
} catch {
|
||||
@@ -189,11 +195,33 @@ function Get-OfficeOdtDownloadUrl {
|
||||
|
||||
function Invoke-OfficeProcess {
|
||||
param([string]$FilePath, [string]$Arguments, [string]$LogPrefix)
|
||||
$null = Write-Output "Running: $FilePath $Arguments. Process logs: $LogPrefix"
|
||||
$process = Start-Process -FilePath $FilePath -ArgumentList $Arguments -WorkingDirectory (Split-Path -Parent $FilePath) -Wait -PassThru -WindowStyle Hidden -RedirectStandardOutput "$LogPrefix.stdout.log" -RedirectStandardError "$LogPrefix.stderr.log" -ErrorAction Stop
|
||||
if ($null -eq $process.ExitCode) { throw "No exit code returned from $FilePath." }
|
||||
$null = Write-Output "Process exited $($process.ExitCode): $FilePath"
|
||||
[int]$process.ExitCode
|
||||
$definitions = Get-OfficeDeploymentDefinitions
|
||||
$isMsi = [IO.Path]::GetFileName($FilePath) -ieq 'msiexec.exe'
|
||||
for ($attempt = 1; ; $attempt++) {
|
||||
$prefix = if ($attempt -eq 1) { $LogPrefix } else { "$LogPrefix.retry-$attempt" }
|
||||
$null = Write-Output "Running: $FilePath $Arguments. Process logs: $prefix"
|
||||
$process = Start-Process -FilePath $FilePath -ArgumentList $Arguments -WorkingDirectory (Split-Path -Parent $FilePath) -Wait -PassThru -WindowStyle Hidden -RedirectStandardOutput "$prefix.stdout.log" -RedirectStandardError "$prefix.stderr.log" -ErrorAction Stop
|
||||
if ($null -eq $process.ExitCode) { throw "No exit code returned from $FilePath." }
|
||||
$null = Write-Output "Process exited $($process.ExitCode): $FilePath"
|
||||
# Retry only MSI's documented busy result, not arbitrary installer failures.
|
||||
if (!$isMsi -or $process.ExitCode -ne 1618 -or $attempt -ge $definitions.MsiBusyAttempts) { return [int]$process.ExitCode }
|
||||
$null = Write-Output "Windows Installer is busy; retrying in $($definitions.MsiBusyRetrySeconds) seconds (attempt $attempt of $($definitions.MsiBusyAttempts))."
|
||||
Start-Sleep -Seconds $definitions.MsiBusyRetrySeconds
|
||||
}
|
||||
}
|
||||
|
||||
function Wait-OfficeResult {
|
||||
param([scriptblock]$Probe, [string]$Description)
|
||||
# A probe returns a verified value/true, or nothing/false while registration catches up.
|
||||
# Read errors still propagate; an inaccessible registry is not proof of removal.
|
||||
$definitions = Get-OfficeDeploymentDefinitions
|
||||
for ($attempt = 1; $attempt -le $definitions.RegistrationCheckAttempts; $attempt++) {
|
||||
$value = & $Probe
|
||||
if ($value) { return $value }
|
||||
if ($attempt -eq $definitions.RegistrationCheckAttempts) { return }
|
||||
if ($attempt -eq 1) { $null = Write-Output "Waiting for $Description (up to $(($definitions.RegistrationCheckAttempts - 1) * $definitions.RegistrationCheckSeconds) seconds)." }
|
||||
Start-Sleep -Seconds $definitions.RegistrationCheckSeconds
|
||||
}
|
||||
}
|
||||
|
||||
function New-OfficeConfiguration {
|
||||
@@ -235,8 +263,9 @@ function Initialize-OfficeMedia {
|
||||
param($Options, [string]$Workspace)
|
||||
$definitions = Get-OfficeDeploymentDefinitions
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
$page = Invoke-WebRequest -UseBasicParsing -Uri $definitions.OdtPage -TimeoutSec $definitions.OdtPageTimeoutSeconds -ErrorAction Stop
|
||||
$url = Get-OfficeOdtDownloadUrl $page.Content
|
||||
$pagePath = Join-Path $Workspace 'odt-download-page.html'
|
||||
Save-OfficeDownload $definitions.OdtPage $pagePath -TimeoutSeconds $definitions.OdtPageTimeoutSeconds
|
||||
$url = Get-OfficeOdtDownloadUrl (Get-Content -LiteralPath $pagePath -Raw -ErrorAction Stop)
|
||||
$package = Join-Path $Workspace 'odt.exe'
|
||||
$null = Write-Output "Downloading current ODT from $url"
|
||||
Save-OfficeDownload $url $package
|
||||
@@ -265,7 +294,13 @@ function Initialize-OfficeMedia {
|
||||
$configPath = Join-Path $Workspace 'install.xml'
|
||||
$config = New-OfficeConfiguration $Options $odtFolder; $config.Save($configPath)
|
||||
$null = Write-Output 'Downloading Office installation files before removing installed apps.'
|
||||
$code = Invoke-OfficeProcess $setup "/download `"$configPath`"" (Join-Path $Workspace 'office-download')
|
||||
for ($attempt = 1; $attempt -le $definitions.DownloadAttempts; $attempt++) {
|
||||
$prefix = if ($attempt -eq 1) { 'office-download' } else { "office-download.retry-$attempt" }
|
||||
$code = Invoke-OfficeProcess $setup "/download `"$configPath`"" (Join-Path $Workspace $prefix)
|
||||
if ($code -eq 0 -or $attempt -eq $definitions.DownloadAttempts) { break }
|
||||
$null = Write-Output "Office download failed ($code); retrying download into the same staging folder (attempt $attempt of $($definitions.DownloadAttempts))."
|
||||
Start-Sleep -Seconds ($definitions.DownloadRetrySeconds * $attempt)
|
||||
}
|
||||
if ($code -ne 0) { throw "Office download failed ($code). Existing Office has not been removed." }
|
||||
$versions = @(Get-ChildItem -LiteralPath (Join-Path $odtFolder 'Office\Data') -Directory -ErrorAction Stop | Where-Object { $_.Name -match $definitions.OfficeBuildPattern })
|
||||
if ($versions.Count -ne 1) { throw 'Office download did not produce one identifiable build.' }
|
||||
@@ -288,7 +323,13 @@ function Stop-OfficeDeploymentApps {
|
||||
if (!$running.Count) { return }
|
||||
if ($Options.OfficeAppShutdown -ne 'Force') { throw "Apps are running: $(($running.ProcessName | Sort-Object -Unique) -join ', '). Close them or select OfficeAppShutdown=Force (unsaved work can be lost)." }
|
||||
$null = Write-Output 'Closing Office, Teams, OneDrive, and new Outlook in every session. Unsaved work can be lost.'
|
||||
$running | Stop-Process -Force -ErrorAction Stop
|
||||
foreach ($process in $running) {
|
||||
try { Stop-Process -InputObject $process -Force -ErrorAction Stop }
|
||||
catch {
|
||||
if (!$process.HasExited) { throw }
|
||||
$null = Write-Output "Process $($process.Id) exited before it could be stopped; continuing."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Get-OfficeCompanionDownloads {
|
||||
@@ -348,7 +389,7 @@ function Install-OfficeCompanionApps {
|
||||
$code = Invoke-OfficeProcess $Media.WebView2 $definitions.CompanionInstallers.WebView2.Arguments (Join-Path $Workspace 'webview2-install')
|
||||
if ($code -notin @(0, 3010)) { throw "WebView2 installation failed (exit $code)." }
|
||||
if ($code -eq 3010) { $reboot = $true }
|
||||
$webViewVersion = Get-OfficeMachineWebViewVersion
|
||||
$webViewVersion = Wait-OfficeResult { Get-OfficeMachineWebViewVersion } 'machine WebView2 registration'
|
||||
if (!$webViewVersion) { throw 'WebView2 setup returned success but no machine-wide runtime was detected.' }
|
||||
}
|
||||
$versions = [ordered]@{ WebView2=$webViewVersion }
|
||||
@@ -362,11 +403,11 @@ function Install-OfficeCompanionApps {
|
||||
if ($code -notin @(0, 3010)) { throw "$($app.Name) installation failed (exit $code). See logs in $Workspace." }
|
||||
if ($code -eq 3010) { $reboot = $true }
|
||||
if ($app.Package) {
|
||||
$packages = @(Get-AppxProvisionedPackage -Online -ErrorAction Stop | Where-Object { $_.DisplayName -eq $app.Package -and $_.PackageName -like ('*' + $definitions.AppxPublisherSuffix) })
|
||||
$packages = @(Wait-OfficeResult { Get-AppxProvisionedPackage -Online -ErrorAction Stop | Where-Object { $_.DisplayName -eq $app.Package -and $_.PackageName -like ('*' + $definitions.AppxPublisherSuffix) } } "$($app.Name) provisioning")
|
||||
if (!$packages.Count) { throw "$($app.Name) setup returned success but the app was not provisioned for all users." }
|
||||
$versions[$app.Name] = ($packages.Version | Sort-Object -Unique) -join ', '
|
||||
} else {
|
||||
$oneDrive = Get-OfficeMachineOneDrive
|
||||
$oneDrive = Wait-OfficeResult { Get-OfficeMachineOneDrive } 'per-machine OneDrive registration'
|
||||
if (!$oneDrive) { throw 'OneDrive setup returned success but a per-machine installation was not detected.' }
|
||||
Assert-OfficeMicrosoftSignature $oneDrive.Path
|
||||
$versions.OneDrive = $oneDrive.Version
|
||||
@@ -422,6 +463,8 @@ function Remove-OfficeSuite {
|
||||
$prefix = Join-Path $Workspace 'office-scrub'
|
||||
$code = Invoke-OfficeProcess $Media.Scrubber (Get-OfficeDeploymentDefinitions).ScrubArguments $prefix
|
||||
$output = (Get-Content -LiteralPath "$prefix.stdout.log" -Raw -ErrorAction Stop) + (Get-Content -LiteralPath "$prefix.stderr.log" -Raw -ErrorAction Stop)
|
||||
Assert-OfficeScrubResult $code $output @()
|
||||
$null = Wait-OfficeResult { @(Get-OfficeSuiteInventory).Count -eq 0 } 'Office removal registration'
|
||||
Assert-OfficeScrubResult $code $output @(Get-OfficeSuiteInventory)
|
||||
}
|
||||
|
||||
@@ -443,25 +486,93 @@ function Get-OfficeOneDriveCommand {
|
||||
[pscustomobject]@{ FilePath = $exe; Arguments = $arguments }
|
||||
}
|
||||
|
||||
function Test-OfficeMachineMsiProduct {
|
||||
param([Parameter(Mandatory=$true)][ValidatePattern('^\{[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\}$')][string]$ProductCode)
|
||||
if (!('Emberkom.OfficeMachineMsi' -as [type])) {
|
||||
Add-Type -TypeDefinition @'
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
namespace Emberkom {
|
||||
public static class OfficeMachineMsi {
|
||||
[DllImport("msi.dll", CharSet=CharSet.Unicode, ExactSpelling=true)]
|
||||
private static extern uint MsiEnumProductsExW(string product, string userSid, uint context, uint index, IntPtr code, IntPtr installedContext, IntPtr sid, IntPtr sidLength);
|
||||
public static uint Find(string product) {
|
||||
// MSIINSTALLCONTEXT_MACHINE requires a native NULL user SID.
|
||||
return MsiEnumProductsExW(product, null, 4, 0, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
}
|
||||
}
|
||||
'@
|
||||
}
|
||||
# Read-only MSI enumeration avoids Win32_Product and its repair side effects.
|
||||
$code = [Emberkom.OfficeMachineMsi]::Find($ProductCode)
|
||||
if ($code -eq 0) { return $true }
|
||||
if ($code -in @(259, 1605)) { return $false }
|
||||
throw "Cannot determine machine MSI registration for $ProductCode (Win32 $code)."
|
||||
}
|
||||
|
||||
function Get-OfficeMachineCompanionEntries {
|
||||
$definitions = Get-OfficeDeploymentDefinitions
|
||||
foreach ($entry in @(Get-OfficeUninstallEntries)) {
|
||||
if ($entry.DisplayName -notin (@('Microsoft OneDrive') + $definitions.TeamsMsiNames)) { continue }
|
||||
if ($entry.DisplayName -eq 'Microsoft Teams Meeting Add-in for Microsoft Office' -and !(Test-OfficeMachineMsiProduct $entry.PSChildName)) {
|
||||
# Some per-user add-ins advertise themselves in HKLM. Their registration alone
|
||||
# does not mean SYSTEM can uninstall them. The user helper checks both hives.
|
||||
$null = Write-Output "No machine MSI registration for $($entry.DisplayName) $($entry.DisplayVersion), $($entry.PSChildName). Per-user registration will be checked by user cleanup. Registry entry: $($entry.PSPath)"
|
||||
continue
|
||||
}
|
||||
$entry
|
||||
}
|
||||
}
|
||||
|
||||
function Remove-OfficeAppxEntry {
|
||||
param([string]$PackageName, [switch]$Provisioned)
|
||||
$definitions = Get-OfficeDeploymentDefinitions
|
||||
for ($attempt = 1; $attempt -le $definitions.AppxRemovalAttempts; $attempt++) {
|
||||
$null = Write-Output "Removing Appx package $PackageName (provisioned=$Provisioned, attempt $attempt)."
|
||||
try {
|
||||
if ($Provisioned) { $null = Remove-AppxProvisionedPackage -Online -PackageName $PackageName -AllUsers -ErrorAction Stop }
|
||||
else { Remove-AppxPackage -Package $PackageName -AllUsers -ErrorAction Stop }
|
||||
} catch {
|
||||
# Another removal can already have removed this registration. Verify before failing.
|
||||
$null = Write-Output "Appx removal reported an error for ${PackageName}: $($_.Exception.Message). Checking state before retrying."
|
||||
}
|
||||
$gone = Wait-OfficeResult {
|
||||
$registered = @(if ($Provisioned) {
|
||||
Get-AppxProvisionedPackage -Online -ErrorAction Stop | Where-Object { $_.PackageName -eq $PackageName }
|
||||
} else {
|
||||
Get-AppxPackage -AllUsers -ErrorAction Stop | Where-Object { $_.PackageFullName -eq $PackageName }
|
||||
})
|
||||
$registered.Count -eq 0
|
||||
} "removal of $PackageName"
|
||||
if ($gone) { return }
|
||||
}
|
||||
throw "Appx package remains after $($definitions.AppxRemovalAttempts) removal attempts: $PackageName. Check the diagnostic log."
|
||||
}
|
||||
|
||||
function Remove-OfficeCompanionApps {
|
||||
param([string]$Workspace)
|
||||
$names = Get-OfficeAppxNames
|
||||
$definitions = Get-OfficeDeploymentDefinitions
|
||||
foreach ($package in @(Get-AppxProvisionedPackage -Online -ErrorAction Stop | Where-Object { $_.DisplayName -in $names })) {
|
||||
$null = Write-Output "Removing provisioned package: $($package.PackageName)"
|
||||
$null = Remove-AppxProvisionedPackage -Online -PackageName $package.PackageName -AllUsers -ErrorAction Stop
|
||||
Remove-OfficeAppxEntry $package.PackageName -Provisioned
|
||||
}
|
||||
foreach ($package in @(Get-AppxPackage -AllUsers -ErrorAction Stop | Where-Object { $_.Name -in $names })) {
|
||||
$null = Write-Output "Removing installed package: $($package.PackageFullName)"
|
||||
Remove-AppxPackage -Package $package.PackageFullName -AllUsers -ErrorAction Stop
|
||||
Remove-OfficeAppxEntry $package.PackageFullName
|
||||
}
|
||||
if (@(Get-AppxPackage -AllUsers -ErrorAction Stop | Where-Object { $_.Name -in $names }).Count) { throw 'Office/Teams/Outlook Store packages remain after removal.' }
|
||||
$gone = Wait-OfficeResult {
|
||||
$installed = @(Get-AppxPackage -AllUsers -ErrorAction Stop | Where-Object { $_.Name -in $names })
|
||||
$provisioned = @(Get-AppxProvisionedPackage -Online -ErrorAction Stop | Where-Object { $_.DisplayName -in $names })
|
||||
($installed.Count + $provisioned.Count) -eq 0
|
||||
} 'Office/Teams/Outlook Store package removal'
|
||||
if (!$gone) { throw 'Office/Teams/Outlook Store packages remain after removal.' }
|
||||
$reboot = $false
|
||||
foreach ($entry in @(Get-OfficeUninstallEntries)) {
|
||||
foreach ($entry in @(Get-OfficeMachineCompanionEntries)) {
|
||||
$null = Write-Output "Removing machine companion: $($entry.DisplayName) $($entry.DisplayVersion). Registry entry: $($entry.PSPath)"
|
||||
if ($entry.DisplayName -in $definitions.TeamsMsiNames) {
|
||||
if ($entry.PSChildName -notmatch '^\{[0-9A-Fa-f-]{36}\}$') { throw 'Teams MSI has an unexpected product code.' }
|
||||
$prefix = Join-Path $Workspace ('teams-' + $entry.PSChildName)
|
||||
$code = Invoke-OfficeProcess "$env:WINDIR\System32\msiexec.exe" "/x $($entry.PSChildName) /qn /norestart /L*v `"$prefix.log`"" $prefix
|
||||
$code = Invoke-OfficeProcess "$env:WINDIR\System32\msiexec.exe" "/x $($entry.PSChildName) /qn /norestart /L+*v `"$prefix.log`"" $prefix
|
||||
} elseif ($entry.DisplayName -eq 'Microsoft OneDrive') {
|
||||
$roots = @((Join-Path $env:ProgramFiles 'Microsoft OneDrive'), (Join-Path $env:WINDIR 'System32'), (Join-Path $env:WINDIR 'SysWOW64'))
|
||||
if (${env:ProgramFiles(x86)}) { $roots += Join-Path ${env:ProgramFiles(x86)} 'Microsoft OneDrive' }
|
||||
@@ -472,7 +583,13 @@ function Remove-OfficeCompanionApps {
|
||||
if ($code -eq 3010) { $reboot = $true }
|
||||
elseif ($code -notin @(0, 1605, 1614)) { throw "Could not remove $($entry.DisplayName) (exit $code)." }
|
||||
}
|
||||
if (@(Get-OfficeUninstallEntries | Where-Object { $_.DisplayName -in (@('Microsoft OneDrive') + $definitions.TeamsMsiNames) }).Count -and !$reboot) { throw 'A machine-wide Teams/OneDrive installation remains after removal.' }
|
||||
if (!$reboot) { $null = Wait-OfficeResult { @(Get-OfficeMachineCompanionEntries).Count -eq 0 } 'machine companion removal registration' }
|
||||
$remaining = @(Get-OfficeMachineCompanionEntries)
|
||||
if ($remaining.Count) {
|
||||
$details = ($remaining | ForEach-Object { "$($_.DisplayName) $($_.DisplayVersion) [$($_.PSPath)]" }) -join '; '
|
||||
$null = Write-Output "Machine companion registrations remaining after removal: $details"
|
||||
if (!$reboot) { throw "Machine companion registrations remain after removal: $details. Check uninstall logs in $Workspace. Office scrub/installation has not started." }
|
||||
}
|
||||
$reboot
|
||||
}
|
||||
|
||||
@@ -547,7 +664,10 @@ function Start-OfficeUserCleanup {
|
||||
$pending = @()
|
||||
foreach ($task in $tasks) {
|
||||
$marker = Get-ItemPropertyValue -LiteralPath "Registry::HKEY_USERS\$($task.SID)\Software\Emberkom\OfficeDeployment\$deploymentId" -Name Status -ErrorAction SilentlyContinue
|
||||
if ($marker -eq 'Complete') { Unregister-ScheduledTask -TaskName $task.Name -Confirm:$false -ErrorAction Stop }
|
||||
if ($marker -eq 'Complete') {
|
||||
try { Unregister-ScheduledTask -TaskName $task.Name -Confirm:$false -ErrorAction Stop }
|
||||
catch { $null = Write-Output "Cleanup completed, but its task could not be unregistered: $($task.Name). The Complete marker makes it a no-op. $($_.Exception.Message)" }
|
||||
}
|
||||
else { $pending += $task.SID; $null = Write-Output "Cleanup pending for $($task.SID); task $($task.Name) runs at their next sign-in." }
|
||||
}
|
||||
return ,$pending
|
||||
@@ -557,9 +677,14 @@ function Install-OfficeMedia {
|
||||
param($Options, $Media, [string]$Workspace)
|
||||
$code = Invoke-OfficeProcess $Media.Setup "/configure `"$($Media.Config)`"" (Join-Path $Workspace 'office-install')
|
||||
if ($code -notin @(0, 3010)) { throw "Office installation failed (exit $code). Media and logs remain in $Workspace." }
|
||||
$installed = Get-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration' -ErrorAction Stop
|
||||
$platform = if ($Options.OfficeArchitecture -eq '64') { 'x64' } else { 'x86' }
|
||||
if ($Options.ProductId -notin ($installed.ProductReleaseIds -split ',') -or $installed.Platform -ne $platform -or $installed.VersionToReport -ne $Media.Version) { throw 'Setup exited successfully but the installed product, architecture, or version did not match.' }
|
||||
$verified = Wait-OfficeResult {
|
||||
$key = 'HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration'
|
||||
if (!(Test-Path -LiteralPath $key -ErrorAction Stop)) { return $false }
|
||||
$installed = Get-ItemProperty -LiteralPath $key -ErrorAction Stop
|
||||
$Options.ProductId -in ($installed.ProductReleaseIds -split ',') -and $installed.Platform -eq $platform -and $installed.VersionToReport -eq $Media.Version
|
||||
} 'the selected Office product, architecture, and version'
|
||||
if (!$verified) { throw 'Setup exited successfully but the installed product, architecture, or version did not match.' }
|
||||
$code
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user