#Requires -Version 5.1 <# JbTecWiz Support Centre -- generated fix script Fault : "Cannot start Microsoft Outlook. Cannot open the Outlook window" Fix : Build a new mail profile Source: https://jbtecwiz.com/support/win-office-outlook-wont-start Run as : Control Panel -> Mail, as the affected user Expect : 45 minutes Risk : medium Reversible : yes WHEN THIS IS THE RIGHT FIX The pane reset did not help and safe mode fails too, or the mailbox has been moved between servers or tenants. HOW TO UNDO IT The old profile is untouched until you delete it -- pick it at the profile prompt to go back. This script walks the fix one step at a time and asks before each one. Steps with no command are things you do yourself -- it prints those and waits. Run with -DryRun to print without executing. #> [CmdletBinding()] param( # Print every step and command without running anything. [switch]$DryRun, # Do not ask before each step. Read the script first if you use this. [switch]$Unattended ) $ErrorActionPreference = 'Stop' $script:Failed = 0 function Write-Rule { param([string]$Text) Write-Host '' Write-Host ('-' * 70) -ForegroundColor DarkGray if ($Text) { Write-Host $Text -ForegroundColor Cyan } } function Show-Prose { param([string]$Text, [string]$Colour = "Gray") if (-not $Text) { return } $words = $Text -split "\s+"; $line = " " foreach ($w in $words) { if (($line.Length + $w.Length) -gt 74) { Write-Host $line -ForegroundColor $Colour; $line = " " } $line += "$w " } if ($line.Trim()) { Write-Host $line -ForegroundColor $Colour } } function Invoke-Step { param( [int]$Number, [string]$Do, [string]$Why, [scriptblock]$Command, [switch]$Manual, [string]$Shell = "powershell" ) Write-Rule " Step $Number of 6" Show-Prose $Do "White" if ($Why) { Write-Host ""; Show-Prose $Why "DarkGray" } if ($Manual) { Write-Host '' Write-Host ' -> Do this yourself, then press Enter to carry on.' -ForegroundColor Yellow if (-not $Unattended -and -not $DryRun) { [void](Read-Host) } return } Write-Host '' foreach ($l in ($Command.ToString().Trim() -split "`n")) { Write-Host (" " + $l.Trim()) -ForegroundColor Green } Write-Host '' if ($DryRun) { Write-Host " (dry run -- not executed)" -ForegroundColor DarkGray; return } if (-not $Unattended) { $a = Read-Host " Run this step? [Y]es / [S]kip / [Q]uit" if ($a -match "^[Qq]") { Write-Host " Stopped at your request."; exit 0 } if ($a -match "^[Ss]") { Write-Host " Skipped." -ForegroundColor DarkGray; return } } try { & $Command } catch { $script:Failed++ Write-Host (" Step $Number failed: " + $_.Exception.Message) -ForegroundColor Red Show-Prose "The rest of the fix may depend on this. Read the write-up before carrying on." "Red" if (-not $Unattended) { $c = Read-Host " Carry on anyway? [y/N]" if ($c -notmatch "^[Yy]") { exit 1 } } } } Write-Rule Write-Host ' "Cannot start Microsoft Outlook. Cannot open the Outlook window"' -ForegroundColor White Write-Host ' Build a new mail profile' -ForegroundColor Cyan Write-Host '' Write-Host ' Risk: medium Reversible 45 minutes' Write-Rule if (-not $Unattended -and -not $DryRun) { $go = Read-Host ' Ready? [y/N]' if ($go -notmatch "^[Yy]") { Write-Host " Nothing was changed."; exit 0 } } Invoke-Step -Number 1 -Do 'Record the account details and the path of any PST files in use before you start.' -Why 'Local PST archives are not carried into a new profile, and their absence afterwards is the thing most often reported as data loss. Note the paths now and re-attaching them later is two clicks.' -Command { Get-ChildItem 'HKCU:\Software\Microsoft\Office\16.0\Outlook\Profiles' | Select-Object PSChildName } Invoke-Step -Number 2 -Do 'Open the Mail control panel and create a new profile rather than repairing the existing one.' -Command { cmd.exe /c 'control mlcfg32.cpl' } Invoke-Step -Number 3 -Do 'Set Outlook to prompt for a profile, so you can switch back to the old one if the new one is worse.' -Manual Invoke-Step -Number 4 -Do 'Add the account and let autodiscover configure it. Do not enter server settings by hand for a Microsoft 365 mailbox.' -Manual Invoke-Step -Number 5 -Do 'Re-attach any PST files via File -> Open & Export -> Open Outlook Data File.' -Manual Invoke-Step -Number 6 -Do 'Once the new profile is proven over a day or so, set it as default and remove the old one.' -Manual Write-Rule " Confirm it worked" Show-Prose 'Outlook opens on the new profile, mail sends and receives, and every archive that was attached before is present.' 'White' Write-Rule if ($script:Failed -gt 0) { Write-Host (" Finished with " + $script:Failed + " failed step(s).") -ForegroundColor Yellow Show-Prose 'Read the full write-up at https://jbtecwiz.com/support/win-office-outlook-wont-start' 'Yellow' } else { Write-Host ' Finished.' -ForegroundColor Green } Write-Host '' Show-Prose 'To undo: The old profile is untouched until you delete it -- pick it at the profile prompt to go back.' 'DarkGray' Write-Rule