A reader asks:

I have been trying to get a script that can log into mailboxes automatically. The reason is that I have 500 mailboxes and when I attempt to query their statistics I get an error that the mailbox has never been logged into and therefore can’t generate any stats.

Let’s take a quick look at the issue itself. When a new mailbox is created and you attempt to use Get-MailboxStatistics to query the mailbox, you will receive a warning similar to this.

WARNING: The user hasn’t logged on to mailbox ‘exchangeserverpro.net/Company/Branch Office/Users/Blake Johnson’
(‘0971ff8e-d6d1-4bd6-98b9-384b35103a2d’), so there is no data to return. After the user logs on, this longer appear.

The User Hasn't Logged on to Mailbox So There is No Data to Return

In itself this is not a problem, but it might produce undesirable results for some mailbox reporting tasks, or at the very least make them a little more difficult.

The idea of creating a script that automatically logs on to new mailboxes is one approach to solving the problem. However it is probably more difficult than another solution which is also available.

That other solution is to simply send the mailbox an email. Once you do that the Get-MailboxStatistics cmdlet will return a result for the mailbox like this:

[PS] C:\>get-mailbox blake.johnson | Get-MailboxStatistics | ft -auto

DisplayName   ItemCount StorageLimitStatus LastLogonTime
-----------   --------- ------------------ -------------
Blake Johnson 1                 BelowLimit

But is it practical to send 500 mailboxes an email? If it is a test lab you could simply add them all to one distribution group, and send that group an email. It would take just a few moments.

If it is a production system and new mailboxes are created regularly, you can automate the task. MVP Pat Richard has written a PowerShell script that can be run as a scheduled task to automatically send a welcome email to new mailboxes. You can customize the welcome message to provide useful information to new users on the network. It really is a great idea if you ask me, plus it solves this issue with mailbox reporting. Check out Pat’s script here.

About the Author

Paul Cunningham

Paul is a former Microsoft MVP for Office Apps and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul no longer writes for Practical365.com.

Comments

  1. Marwan2020

    have same issue with the in place archive in exchange 2019

    and most of the in place archive mailbox cannot be accessed useuing owa

    how did you resolve the issue

  2. Tomas

    Hi, I can see this is old reply but when having this issue in Online Archive just run this:
    Start-ManagedFolderAssistant -Identity XXX -FullCrawl
    This works for me always!

  3. Vladimír

    Hi, in my case i resolved this issue with another cmdlet. I call this:

    Get-MailboxFolderStatistics -Identity ‘user@domain.com’ -FolderScope ‘Inbox’

    and it seems to work for me.

  4. Ray Benkart

    Hi Paul,

    I have this issue when accessing the in-place Archive for a couple of users. Have you seen that and do you have a suggestions for the fix. They also can no longer access there Archive

    New-MailboxRepairRequest -Mailbox snagle -CorruptionType ProvisionedFolder,SearchFolder,A
    ggregateCounts,Folderview -Archive
    WARNING: The user hasn’t logged on to mailbox ’64f7fa33-b227-4c7f-ac38-cce8c929baaa’ (‘mailma11_db13’), so there is no
    data to return. After the user logs on, this warning will no longer appear.

    1. Marwan2020

      I have same issue with the in place archive in exchange 2019

      and most of the in place archive mailbox cannot be accessed

      how did yih resolve the issue

  5. Scott Rader

    How would you resolve this for the Online/Personal Archive feature set for a Shared Mailbox?

    Get-MailboxStatistics $SharedMailbox -Archive | fl

    You can’t login because the user account is disabled and the Archive Mailbox doesn’t receive sent mail…

  6. Jon

    I like the idea of sending an email. If a user has never logged on, it’s possible they never will. However, the referenced script does not solve the problem of OLD mailboxes that have never been logged onto. I had a couple thousand mailboxes to deal with and some of them were very old.

    To solve, I ran the following:

    get-mailbox -resultSize Unlimited | get-mailboxStatistics | ?{$_ -eq $null}

    That gave me a list of users that had zero data to return. Not elegant, but it allowed me to take the output and whack it apart with a text editor to seed all of those mailboxes with an email (without bothering people who *have* logged in already.)

    Now I can use the referenced script (or maybe the new-inboxrule) to deal with new mailboxes.

  7. I.B

    Hey Paul, is it possible to do the LastUserLogon if they are logging in from a different AD? we have a cross-forest migration with users remaining in separate forest from the mailboxes, but we still want to see when the mailbox was last used.

    Any ideas would be great.

  8. A.G.

    Hey Paul, I read the code and basically get the idea.
    But I get confused to implement the script to environment (kinda new in Exchange and PS)
    Maybe you know good (best be yours) to PS remote scrips and schedule. Thanks!

  9. Gene

    One trick I’ve been using to force the creation of a mailbox is to create a bogus Inbox rule (of course this only works in 2010). I’ve had to work on scripts that create mailboxes and then make changes to the mailbox which can’t be done if the mailbox doesn’t exist. So I use New-InboxRule to create a rule that moves mail from the user to a folder that does not exist. Because the system needs to go into the mailbox to see if the folder exists, it needs to create the mailbox fist.

    Here is my call:
    New-InboxRule -Mailbox $distinguishedName -Name “RemoveThisRule” -From “$username@bu.edu” -MoveToFolder “Inboxoawnbfeoanwvoipawoinbra;wea” -confirm:$false

Leave a Reply