update M365 deployment script to try not to depend on previous deployments

This commit is contained in:
2026-10-29 14:29:37 -04:00
parent e2163a6158
commit 3e24920646
7 changed files with 465 additions and 85 deletions
+5 -3
View File
@@ -1,6 +1,6 @@
#Requires -Version 5.1
# EmberkomOfficeUserCleanup-v4
# Run only as the affected user, at limited privilege; staged by the Office installer.
# EmberkomOfficeUserCleanup-v5
# Run only as the affected user, at limited privilege; fetched live by its logon task.
param([Parameter(Mandatory = $true)][ValidatePattern('^[a-f0-9]{32}$')][string]$DeploymentId)
function Get-OfficeUserCleanupDefinitions {
@@ -184,7 +184,9 @@ $null = Start-Transcript -Path (Join-Path $logFolder "$DeploymentId.log") -Appen
try {
$null = New-Item -Path $marker -Force
Set-ItemProperty -LiteralPath $marker -Name Status -Value 'Running'
Invoke-OfficeUserCleanup -Workspace $PSScriptRoot
# The scheduled action fetches this helper live into memory. Only protected
# synchronization state persists on disk; PSScriptRoot is empty in this mode.
Invoke-OfficeUserCleanup -Workspace (Join-Path $env:ProgramData "EmberkomOfficeDeployment\$DeploymentId")
Set-ItemProperty -LiteralPath $marker -Name Status -Value 'Complete'
} catch {
Set-ItemProperty -LiteralPath $marker -Name Status -Value 'Failed'