Category Archives: Computers and Internet

Exchange: Shared Mailbox is not able to open in Outlook (with Full Access permissions) or in OWA

A Shared mailbox is not show up in Outlook or not able to open in OWA, and it gives this error in OWA:

“Your Account has been disabled”

Do not check the Active Directory Account. It is nothing to do with the user account. Error message means OWA is disabled on the mailbox.


Exchange Admin Console:

  • Find the mailbox and click to select
  • On the right-side pane, find Outlook on the Web under Email Connectivity.
  • Enable the OWA
  • Open Mailbox Properties and select Mailbox Features
  • Find and enable MAPI

Exchange Admin Shell:

Set-CASMailbox <Mailbox Alias> -OWAEnabled:$true -MapiEnabled:$true

If you run this command, OWAEnabled should show True:

E:\ Get-CASMailbox 
Name ActiveSyncEnabled OWAEnabled PopEnabled ImapEnabled MapiEnabled SmtpClientAuthenticationDisabled
---- ----------------- ---------- ---------- ----------- ----------- --------------------------------
offers True True False False False

PowerShell: Find Account Lockouts and which computer is locking the account?

How many time have you researched where the account lockouts are happening? which computer is locking the AD account? It could be

  • disconnected remote desktop session
  • scheduled task
  • Application on a server
  • Service running with AD account context
  • Wireless profile with PEAP setup on Phones and devices

So I wrote this PowerShell script to query the Security events from domain controller, and list the callercomputer of where the lockouts are happening.

This following script takes two parameters. Username and domain controller name.

Note: You need run this script as Domain Administrator or at least with server operations privilege.

Search-Lockout-Events.ps1 -username JohnDoe -DomainControllerName

Here is the script, either download is from HERE or copy/paste from below:

    Script: Search-Lockout-Events.ps1
    UserName : SAMAccountName of the user
    DomainControllerName: domain Controller name (FQDN is better)

    Purpose: Search given domain controller for "bad password attempts" and
    "Account lock out" events from the Security Event Logs and list the 
    CallerComputer of where the account lockouts are coming from. 

    Written By: Anand, the Awesome, Venkatachalapathy

#Filenme to store the lockout events
$ReportFile = ".\$Username-Lockedout-Events.txt"

#Query the domain controller event log for lockout events
$LockoutEvents = Get-WinEvent @{logname='Security';starttime=[DateTime]::Today;id=644,4740,4625} `
    -ComputerName $DomainControllerName | ?{$_.Message -like "*$username*" } 

#Display the Date and caller computer from the event logs
foreach($LockoutEvent in $LockoutEvents)
    $message = ($LockoutEvent.Message).Split("`n`r")
    $TimeCreated = [String] $LockoutEvent.TimeCreated

    #Find the Caller Computer from the event log message
    foreach($line in $message) 
        if($line -like '*Caller Computer Name:*')
        { $CallerComputer = $line  ; $CallerComputer = $CallerComputer.Replace("Caller Computer Name: ","")} 

    $TimeCreated + "`t`t" + $CallerComputer

    #Store the event log details to the file
    $LockoutEvent | Format-List |  Out-File -FilePath $ReportFile -Append
#  * * * End of the Script * * * 

How do you delete Office 365 account permenantly?

Well, there are situations you need to delete an Office 365 (MSOL) account permanently.

E.g., I need to create a new account with the same name but for a different user. Since there is a deleted MSOL account still exists, you can’t create the new user.

It is very easy. Open PowerShell and connect to AzureAD:

Connect-MSOLService -Credential (Get-Credential)

First you need to get the ObjectID of the deleted account. Here is how you do it.

Command: Get-MsolUser
-ReturnDeletedUsers -searchstring *UserUPN here* | fl UserPrincipleName,
Example: Get-MsolUser -ReturnDeletedUsers -searchstring | fl UserPrincipleName, ObjectID

Now note down the ObjectID from the above command and use it for next command. Then we need to purge the deleted account.

Command: Remove-MsolUser
-ObjectID *ObjectID here* -RemoveFromRecycleBin -Force
Example: Remove-MsolUser
-ObjectID c4d86044-bd23-7218-c226-e556a25a2dac -RemoveFromRecycleBin -Force

That’s it. You sent this specific MSOL account to Hell forever.

Now, do you want to “Purge” all deleted MSOL accounts? Get Nasty. Here is how you do it.

Get-MsolUser -ReturnDeletedUsers -All |
Remove-MsolUser -RemoveFromRecycleBin -Force

Exchange: Make new retention policy as default and Apply all mailboxes

After you created an Exchange Retention Policy either in Exchange Online or On-Prem Exchange, you have to make this new retention policy as Default, so new mailboxes will get this policy automatically.

To see the available retention policies, type


To change your Default Retention Policy for all users, run the following (Copy the retention policy name from the results of the above command):

Set-RetentionPolicy -Identity "Your Policy Name" -IsDefault:$true  

Now, we need to assign this policy to all existing mailboxes.

Get-Mailbox -ResultSize Unlimited | Set-Mailbox -RetentionPolicy "Your Policy Name"

That’s it. Enjoy!

How to open Shared Mailboxes in Outlook with its own mail profile?

This question has been asked many times and usually assumed it is not possible. It is possible to create a stand-alone Outlook mail profile for Office 365 / Exchange Online or even in On-Premises Exchange server. You don’t need to enable Shared Mailbox’s AD account or use Shared Mailbox’s AD account. All you need to verify is you have FULL access permissions to the Shared Mailbox.

Now, this is how it is done:

  1. Close Outlook if it is already open.
  2. Open Control Panel and Open Mail (Microsoft Outlook 2016)

  3. Click Show Profiles.. and Click Add… to create a new profile. Enter the appropriate name of the profile.
  4. In Add Account window, Enter the Name of the Shared Mailbox (well you can type anything here), then enter the Email Address of the Shared Mailbox.

    Note: You don’t need to type password at all here.

  5. Click Next

  1. When asked, enter YOUR CREDENTIALS. Since you have full access permission on the Shared Mailbox, profile should create it successfully.

That’s all. Don’t forget to change the default Outlook profile in Mail settings.


Outlook: How to delete emails after X number of days automatically?

This is client side solution of automatically deleting emails after X number of days.  We are going to use Outlook’s AutoArchive feature. Don’t worry AutoArchive feature can delete emails also. 

I would recommend create an Outlook rule to move the emails you want to delete after X number of days. Just to make sure this tip is for Outlook on Windows. 

Lets get to the instructions:

  • Open Outlook
  • Go to Files >> Options >> Advanced >> Auto Archive Settings
    1. Set Run AutoArchive every ___days to you liking. This means the emails will be deleted every X number of days automatically.
    2. Do you need to be prompted before AutoArchive Runs? Check the box for Prompt before AutoArchive runs
    3. Choose Permanently delete old itemsDo not click on Apply these settings to all folders now.
    4. Close OK.
  • Go and find the Outlook folder where the email needs to be deleted. 
  • Right click on the folder and choose Properties, then open AutoArchive tab.
    • Select Archive this folder using these settings
    • Select Clean out items older than __ Weeks. If you want to delete the emails after 90 days, type 90 and select days. 
    • Select Permanently delete old items
    • Click OK

That’s all. You have done it. Wait for the AutoArchive to kick in and watch it delete the emails automatically.

Hope that helped you. Enjoy and Leave me a reply.