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

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.

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 Paul Cunningham

Paul is a Microsoft Exchange Server MVP and publisher of Exchange Server Pro. He also holds several Microsoft certifications including for Exchange Server 2007, 2010 and 2013. Find Paul on Twitter, LinkedIn or Google+, or get in touch for consulting/support engagements.

Comments

  1. 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

  2. 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!

  3. 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.

  4. 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.

Leave a Comment

*

We are an Authorized DigiCert™ SSL Partner.