Skip to content
Menu

Outlook Won't Open or Keeps Asking for a Password - Rebuild the Profile

Creates a new, empty classic Outlook profile for the signed-in user and sets it as default, with the registry backed up first. The old profile and mail data are never touched.

Outlook won't open or keeps asking for a password - rebuild the profile is free for members.

Enter your email to create your free account and get the file.

We'll email you the script and the weekly MSP Outpost email. Unsubscribe anytime. Privacy policy.

Already a member? Sign in.

Be the first to review Outlook won't open or keeps asking for a password - rebuild the profile. Tell other MSPs how it worked for you.

Write a Review

LanguagePowerShell
Runs onWindows 10, Windows 11; runs as SYSTEM
NeedsPowerShell 5.1, administrator rights, a user signed in at the console, classic Outlook
Changes thingsChanges what it runs on

What It Does

For the user signed in at the console, in classic Outlook (Office 2013 to Microsoft 365 apps, in the HKCU Office 16.0 or 15.0 Outlook key), the script refuses to continue if Outlook is running unless CloseOutlook is true. Then it asks Outlook to close and stops it after CloseWaitSeconds if it is still open, so unsaved drafts are lost. It backs up the whole Outlook registry key to the MSPOutpost backup folder, creates a new, empty profile named ProfileName and the date, for example Outlook 2026-11-16, and sets it as the default profile.

It never deletes the old profile, which stays in the profile list, and the backup can restore it. It never touches OST or PST files or mail data, and never starts Outlook. On its next start Outlook finds the new profile has no account and runs its automatic account setup, so the user may be asked to confirm their address or sign in once. The mailbox is downloaded again into a new OST file, and the old OST file is left in place and can be deleted later.

It is skipped when nobody is signed in, or when classic Outlook is not set up for that user, because the new Outlook for Windows has no profiles. If the named profile for today already exists and is the default, it says so and changes nothing. If it exists but is not the default, the script reuses it and sets it as default. On another day it uses a new date in the profile name.

Before You Run It

  • Tell the user. They may be asked to sign in once, and the mailbox downloads again, which takes time.
  • Use CloseOutlook only when you accept that unsaved drafts in a running Outlook are lost.
  • Check it is classic Outlook. The new Outlook for Windows has no profiles to rebuild.
  • Run it with DryRun=true first. It lists the profile it would create and whether Outlook is running.

Type and Risk

  • Type: Action. It makes its change, checks the change worked and says what changed. It exits 0, or 2 when it could not do the job.
  • Risk: Low. Set DryRun=true, or run it with -WhatIf, to list every change without making any.
  • What it changes: Creates a new Outlook profile in the signed-in user's registry and makes it the default; with CloseOutlook, closes Outlook; backs up the Outlook registry key first.
  • Restart: It never restarts the machine.
  • Typical run: Under 1 minute.
  • Example answer: "Created Outlook profile 'Outlook 2026-11-16' and set it as default; the old profile is kept. Outlook sets up the account at its next start."
  • Tested before listing on Windows 11 with Windows PowerShell 5.1, run as SYSTEM, against its own test cases.

Inputs

Pass an input as an argument (-Name value), as an environment variable with the same name, which is how most RMMs pass script variables, or change its default in the param() block at the top of the script. An argument wins over an environment variable, which wins over the default.

  • ProfileName: Base name of the new profile; the date is added. Letters, digits, space, dot, underscore and hyphen, up to 40 characters. Default Outlook.
  • CloseOutlook: true to close Outlook if it is running (gracefully, then forced). Default false: a running Outlook ends the run with an error.
  • CloseWaitSeconds: With CloseOutlook, how long to wait for Outlook to close by itself before stopping it. Whole number, 5 to 120. Default 30.

Every script also takes DryRun, OutputFormat (Text, Answer, Json or Csv), ExportPath and ResultField, which writes the answer to an RMM custom field.

License

Provided "as is" under the MIT License, without warranty of any kind. Test before production use. MSP Outpost and User First Digital Inc. accept no liability for any damage or loss.

The Script

repair-outlook-profile.ps1 · 919 lines · 47.2 KB

Free for Members

Create a free account or sign in to read, copy and download this script.

Welcome Back

Sign in to your MSP Outpost account.