Fix Outlook add-in registration: use Exchange or manual sideload
The TrustedCatalogs registry approach only works for Word/Excel/ PowerPoint, NOT for Outlook. Outlook add-ins must be registered via Exchange or manually through OWA. Setup now offers two paths: - Exchange Online PowerShell (New-App) for organizations - Manual sideload via https://aka.ms/olksideload as fallback Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
69b3c417f1
commit
4bea737696
|
|
@ -416,78 +416,111 @@ try {
|
||||||
|
|
||||||
Write-Header "Schritt 5: Outlook Add-in registrieren"
|
Write-Header "Schritt 5: Outlook Add-in registrieren"
|
||||||
|
|
||||||
# Manifest-Katalog-Ordner einrichten
|
# Manifest-Datei vorbereiten
|
||||||
$catalogDir = Join-Path $InstallDir "manifest-catalog"
|
$manifestDir = Join-Path $InstallDir "manifest-catalog"
|
||||||
New-Item -ItemType Directory -Path $catalogDir -Force | Out-Null
|
New-Item -ItemType Directory -Path $manifestDir -Force | Out-Null
|
||||||
Copy-Item -Path (Join-Path $InstallDir "manifest.xml") -Destination $catalogDir -Force
|
Copy-Item -Path (Join-Path $InstallDir "manifest.xml") -Destination $manifestDir -Force
|
||||||
|
$manifestFile = Join-Path $manifestDir "manifest.xml"
|
||||||
|
|
||||||
# Terminal Server erkennen
|
# Outlook Add-ins koennen NICHT per Registry/Shared Folder Catalog registriert werden.
|
||||||
$isTerminalServer = $false
|
# Das funktioniert nur fuer Word/Excel/PowerPoint.
|
||||||
$rdRole = Get-WindowsFeature -Name "RDS-RD-Server" -ErrorAction SilentlyContinue
|
# Fuer Outlook gibt es zwei Wege:
|
||||||
if ($rdRole -and $rdRole.Installed) {
|
# 1. Exchange Online PowerShell (New-App) - fuer Organisationen mit Exchange
|
||||||
$isTerminalServer = $true
|
# 2. Manuell ueber Outlook Web App (OWA) - fuer alle
|
||||||
} elseif ((Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server" -Name "TSAppCompat" -ErrorAction SilentlyContinue).TSAppCompat -eq 1) {
|
|
||||||
$isTerminalServer = $true
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($isTerminalServer) {
|
$registeredViaExchange = $false
|
||||||
Write-Step "Terminal Server erkannt - registriere Add-in fuer alle Benutzer (HKLM)."
|
|
||||||
}
|
|
||||||
|
|
||||||
# Outlook Classic: Shared Folder Catalog per Registry konfigurieren
|
Write-Host " Outlook Add-ins muessen ueber Exchange oder manuell registriert werden." -ForegroundColor Gray
|
||||||
# Terminal Server: HKLM (gilt fuer alle User), sonst HKCU
|
Write-Host ""
|
||||||
$outlookVersions = @("16.0", "15.0")
|
|
||||||
$registeredClassic = $false
|
|
||||||
|
|
||||||
foreach ($ver in $outlookVersions) {
|
# Variante 1: Exchange Online PowerShell versuchen
|
||||||
# Pruefen ob diese Outlook-Version installiert ist
|
$tryExchange = Read-Host "Haben Sie Exchange Online und moechten das Add-in per Exchange bereitstellen? (j/n)"
|
||||||
$outlookPath = "HKLM:\Software\Microsoft\Office\$ver\Outlook"
|
|
||||||
if (-not (Test-Path $outlookPath)) {
|
if ($tryExchange -eq "j") {
|
||||||
$outlookPath = "HKLM:\Software\WOW6432Node\Microsoft\Office\$ver\Outlook"
|
Write-Step "Pruefe Exchange Online PowerShell Modul ..."
|
||||||
|
|
||||||
|
# Modul pruefen/installieren
|
||||||
|
$exModule = Get-Module -ListAvailable -Name "ExchangeOnlineManagement" -ErrorAction SilentlyContinue
|
||||||
|
if (-not $exModule) {
|
||||||
|
Write-Warn "ExchangeOnlineManagement Modul nicht gefunden."
|
||||||
|
$installModule = Read-Host "Modul jetzt installieren? (j/n)"
|
||||||
|
if ($installModule -eq "j") {
|
||||||
|
try {
|
||||||
|
Install-Module -Name ExchangeOnlineManagement -Force -Scope CurrentUser
|
||||||
|
Write-Step "Modul installiert."
|
||||||
|
} catch {
|
||||||
|
Write-Err "Modul-Installation fehlgeschlagen: $_"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Test-Path $outlookPath) {
|
$exModule = Get-Module -ListAvailable -Name "ExchangeOnlineManagement" -ErrorAction SilentlyContinue
|
||||||
Write-Step "Outlook $ver (Classic) gefunden."
|
if ($exModule) {
|
||||||
|
try {
|
||||||
|
Import-Module ExchangeOnlineManagement
|
||||||
|
|
||||||
$catalogId = [guid]::NewGuid().ToString("B")
|
Write-Host ""
|
||||||
|
Write-Host " Es oeffnet sich ein Anmeldefenster fuer Exchange Online." -ForegroundColor Gray
|
||||||
|
Write-Host " Bitte mit einem Exchange-Administrator-Konto anmelden." -ForegroundColor Gray
|
||||||
|
Write-Host ""
|
||||||
|
|
||||||
# Bei Terminal Server: in HKLM registrieren (gilt fuer alle User)
|
Connect-ExchangeOnline -ShowBanner:$false
|
||||||
if ($isTerminalServer) {
|
|
||||||
$outlookRegPath = "HKLM:\Software\Microsoft\Office\$ver\WEF\TrustedCatalogs"
|
$manifestBytes = [System.IO.File]::ReadAllBytes($manifestFile)
|
||||||
$catalogRegPath = Join-Path $outlookRegPath $catalogId
|
|
||||||
New-Item -Path $catalogRegPath -Force | Out-Null
|
# Als Organisations-App bereitstellen (fuer alle Benutzer)
|
||||||
New-ItemProperty -Path $catalogRegPath -Name "Url" -Value $catalogDir -PropertyType String -Force | Out-Null
|
$orgApp = Read-Host "Fuer alle Benutzer der Organisation bereitstellen? (j/n)"
|
||||||
New-ItemProperty -Path $catalogRegPath -Name "Flags" -Value 1 -PropertyType DWord -Force | Out-Null
|
if ($orgApp -eq "j") {
|
||||||
Write-Step "Add-in Katalog fuer alle Benutzer registriert (HKLM)."
|
New-App -OrganizationApp -FileData $manifestBytes -DefaultStateForUser Enabled | Out-Null
|
||||||
|
Write-Step "Add-in fuer alle Benutzer der Organisation bereitgestellt!"
|
||||||
|
} else {
|
||||||
|
# Nur fuer bestimmte Mailbox
|
||||||
|
$mailbox = Read-Host "E-Mail-Adresse des Benutzers"
|
||||||
|
New-App -Mailbox $mailbox -FileData $manifestBytes | Out-Null
|
||||||
|
Write-Step "Add-in fuer $mailbox bereitgestellt!"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Immer auch in HKCU fuer den aktuellen User (Fallback / Einzelplatz)
|
$registeredViaExchange = $true
|
||||||
$outlookRegPathUser = "HKCU:\Software\Microsoft\Office\$ver\WEF\TrustedCatalogs"
|
Disconnect-ExchangeOnline -Confirm:$false -ErrorAction SilentlyContinue
|
||||||
$catalogRegPathUser = Join-Path $outlookRegPathUser $catalogId
|
|
||||||
New-Item -Path $catalogRegPathUser -Force | Out-Null
|
|
||||||
New-ItemProperty -Path $catalogRegPathUser -Name "Url" -Value $catalogDir -PropertyType String -Force | Out-Null
|
|
||||||
New-ItemProperty -Path $catalogRegPathUser -Name "Flags" -Value 1 -PropertyType DWord -Force | Out-Null
|
|
||||||
|
|
||||||
Write-Step "Add-in Katalog fuer Outlook Classic registriert."
|
} catch {
|
||||||
$registeredClassic = $true
|
Write-Err "Exchange-Registrierung fehlgeschlagen: $_"
|
||||||
|
Write-Warn "Das Add-in kann stattdessen manuell hinzugefuegt werden (siehe unten)."
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-not $registeredClassic) {
|
# Variante 2: Manuelle Registrierung (Fallback / kein Exchange)
|
||||||
Write-Warn "Outlook Classic nicht in der Registry gefunden."
|
if (-not $registeredViaExchange) {
|
||||||
}
|
Write-Host ""
|
||||||
|
Write-Header "Add-in manuell in Outlook registrieren"
|
||||||
# Pruefen ob New Outlook installiert ist
|
Write-Host " Das Add-in muss in Outlook manuell hinzugefuegt werden." -ForegroundColor White
|
||||||
$newOutlook = Get-AppxPackage -Name "Microsoft.OutlookForWindows" -ErrorAction SilentlyContinue
|
Write-Host " Dies gilt fuer Outlook Classic UND das neue Outlook." -ForegroundColor White
|
||||||
if ($newOutlook) {
|
Write-Host ""
|
||||||
Write-Step "Neues Outlook gefunden: Version $($newOutlook.Version)"
|
Write-Host " Variante A - Ueber Outlook Web App:" -ForegroundColor Cyan
|
||||||
Write-Warn "Fuer das neue Outlook muss das Add-in manuell hinzugefuegt werden:"
|
Write-Host " 1. Im Browser oeffnen: https://aka.ms/olksideload" -ForegroundColor White
|
||||||
|
Write-Host " 2. 'Meine Add-Ins' -> 'Benutzerdefinierte Add-Ins'" -ForegroundColor White
|
||||||
|
Write-Host " 3. 'Benutzerdefiniertes Add-In hinzufuegen' -> 'Aus Datei hinzufuegen'" -ForegroundColor White
|
||||||
|
Write-Host " 4. Datei waehlen: $manifestFile" -ForegroundColor Yellow
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host " Variante B - Direkt in Outlook Classic:" -ForegroundColor Cyan
|
||||||
|
Write-Host " 1. Outlook Classic oeffnen" -ForegroundColor White
|
||||||
|
Write-Host " 2. Datei -> Info -> 'Add-Ins verwalten' (oeffnet sich im Browser)" -ForegroundColor White
|
||||||
|
Write-Host " 3. Weiter wie bei Variante A ab Schritt 2" -ForegroundColor White
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host " Variante C - Direkt im neuen Outlook:" -ForegroundColor Cyan
|
||||||
Write-Host " 1. Neues Outlook oeffnen" -ForegroundColor White
|
Write-Host " 1. Neues Outlook oeffnen" -ForegroundColor White
|
||||||
Write-Host " 2. Einstellungen (Zahnrad) -> Add-Ins verwalten" -ForegroundColor White
|
Write-Host " 2. Einstellungen (Zahnrad) -> Add-Ins verwalten" -ForegroundColor White
|
||||||
Write-Host " 3. 'Benutzerdefinierte Add-Ins' -> 'Aus Datei hinzufuegen'" -ForegroundColor White
|
Write-Host " 3. 'Benutzerdefinierte Add-Ins' -> 'Aus Datei hinzufuegen'" -ForegroundColor White
|
||||||
Write-Host " 4. Datei waehlen: $catalogDir\manifest.xml" -ForegroundColor White
|
Write-Host " 4. Datei waehlen: $manifestFile" -ForegroundColor Yellow
|
||||||
} else {
|
Write-Host ""
|
||||||
Write-Step "Neues Outlook nicht installiert (nur Classic erkannt)."
|
|
||||||
|
$openBrowser = Read-Host "Sideload-Seite jetzt im Browser oeffnen? (j/n)"
|
||||||
|
if ($openBrowser -eq "j") {
|
||||||
|
Start-Process "https://aka.ms/olksideload"
|
||||||
|
Write-Step "Browser geoeffnet. Bitte Add-in wie oben beschrieben hinzufuegen."
|
||||||
|
Write-Host " Manifest-Datei: $manifestFile" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
|
|
@ -499,10 +532,11 @@ $installInfo = @{
|
||||||
localPort = $localPort
|
localPort = $localPort
|
||||||
taskName = $taskName
|
taskName = $taskName
|
||||||
installedAt = (Get-Date).ToString("o")
|
installedAt = (Get-Date).ToString("o")
|
||||||
catalogDir = $catalogDir
|
manifestDir = $manifestDir
|
||||||
manifestUrl = "https://localhost:$localPort"
|
manifestUrl = "https://localhost:$localPort"
|
||||||
caThumbprint = $caCert.Thumbprint
|
caThumbprint = $caCert.Thumbprint
|
||||||
localhostThumbprint = $localhostCert.Thumbprint
|
localhostThumbprint = $localhostCert.Thumbprint
|
||||||
|
registeredViaExchange = $registeredViaExchange
|
||||||
}
|
}
|
||||||
$installInfo | ConvertTo-Json | Set-Content (Join-Path $InstallDir "install-info.json") -Encoding UTF8
|
$installInfo | ConvertTo-Json | Set-Content (Join-Path $InstallDir "install-info.json") -Encoding UTF8
|
||||||
|
|
||||||
|
|
@ -514,17 +548,16 @@ Write-Header "Installation abgeschlossen!"
|
||||||
|
|
||||||
Write-Host " Installationsverzeichnis: $InstallDir" -ForegroundColor White
|
Write-Host " Installationsverzeichnis: $InstallDir" -ForegroundColor White
|
||||||
Write-Host " Lokaler Server: https://localhost:$localPort" -ForegroundColor White
|
Write-Host " Lokaler Server: https://localhost:$localPort" -ForegroundColor White
|
||||||
Write-Host " Manifest: $catalogDir\manifest.xml" -ForegroundColor White
|
Write-Host " Manifest: $manifestFile" -ForegroundColor White
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
|
|
||||||
if ($registeredClassic) {
|
if ($registeredViaExchange) {
|
||||||
Write-Host " Outlook Classic: Add-in wurde automatisch registriert." -ForegroundColor Green
|
Write-Host " Outlook Add-in wurde per Exchange bereitgestellt." -ForegroundColor Green
|
||||||
Write-Host " Outlook neu starten, dann 'Kontakt-Sync' im Ribbon suchen." -ForegroundColor Green
|
Write-Host " Es kann einige Minuten dauern bis es in Outlook erscheint." -ForegroundColor Green
|
||||||
}
|
} else {
|
||||||
|
Write-Host " [!] Add-in muss noch manuell in Outlook hinzugefuegt werden!" -ForegroundColor Yellow
|
||||||
if ($newOutlook) {
|
Write-Host " Manifest-Datei: $manifestFile" -ForegroundColor Yellow
|
||||||
Write-Host ""
|
Write-Host " Oder im Browser: https://aka.ms/olksideload" -ForegroundColor Yellow
|
||||||
Write-Host " Neues Outlook: Bitte Add-in manuell hinzufuegen (siehe oben)." -ForegroundColor Yellow
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
|
|
|
||||||
|
|
@ -99,35 +99,25 @@ if (Test-Path $certInfoPath) {
|
||||||
# Schritt 3: Outlook Add-in Registrierung entfernen
|
# Schritt 3: Outlook Add-in Registrierung entfernen
|
||||||
# ============================================================
|
# ============================================================
|
||||||
|
|
||||||
Write-Header "Schritt 3: Outlook-Registrierung entfernen"
|
Write-Header "Schritt 3: Outlook Add-in Registrierung"
|
||||||
|
|
||||||
$outlookVersions = @("16.0", "15.0")
|
# Pruefen ob per Exchange registriert
|
||||||
foreach ($ver in $outlookVersions) {
|
$installInfoPath = Join-Path $InstallDir "install-info.json"
|
||||||
# HKCU (Einzelplatz / aktueller User)
|
$registeredViaExchange = $false
|
||||||
$catalogBasePath = "HKCU:\Software\Microsoft\Office\$ver\WEF\TrustedCatalogs"
|
if (Test-Path $installInfoPath) {
|
||||||
if (Test-Path $catalogBasePath) {
|
$installInfo = Get-Content $installInfoPath -Raw | ConvertFrom-Json
|
||||||
$catalogs = Get-ChildItem $catalogBasePath -ErrorAction SilentlyContinue
|
$registeredViaExchange = $installInfo.registeredViaExchange -eq $true
|
||||||
foreach ($catalog in $catalogs) {
|
}
|
||||||
$url = Get-ItemProperty -Path $catalog.PSPath -Name "Url" -ErrorAction SilentlyContinue
|
|
||||||
if ($url -and $url.Url -like "*StarfaceOutlookSync*") {
|
|
||||||
Remove-Item $catalog.PSPath -Recurse -Force
|
|
||||||
Write-Step "Outlook $ver Katalog-Registrierung entfernt (HKCU)."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# HKLM (Terminal Server / alle User)
|
if ($registeredViaExchange) {
|
||||||
$catalogBasePathLM = "HKLM:\Software\Microsoft\Office\$ver\WEF\TrustedCatalogs"
|
Write-Warn "Das Add-in wurde per Exchange bereitgestellt."
|
||||||
if (Test-Path $catalogBasePathLM) {
|
Write-Host " Um es dort zu entfernen:" -ForegroundColor Gray
|
||||||
$catalogs = Get-ChildItem $catalogBasePathLM -ErrorAction SilentlyContinue
|
Write-Host " 1. Exchange Online PowerShell: Get-App | Remove-App" -ForegroundColor Gray
|
||||||
foreach ($catalog in $catalogs) {
|
Write-Host " 2. Oder im Microsoft 365 Admin Center" -ForegroundColor Gray
|
||||||
$url = Get-ItemProperty -Path $catalog.PSPath -Name "Url" -ErrorAction SilentlyContinue
|
} else {
|
||||||
if ($url -and $url.Url -like "*StarfaceOutlookSync*") {
|
Write-Step "Das Add-in wurde manuell in Outlook hinzugefuegt."
|
||||||
Remove-Item $catalog.PSPath -Recurse -Force
|
Write-Host " Bitte manuell entfernen:" -ForegroundColor Gray
|
||||||
Write-Step "Outlook $ver Katalog-Registrierung entfernt (HKLM)."
|
Write-Host " Outlook -> Add-Ins verwalten -> Add-In entfernen" -ForegroundColor Gray
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue