Thursday, 4 August 2016

Mailbox : WhenCreated vs WhenMailboxCreated

You should have noticed the two attributes WhenCreated and WhenWhenMailbox while fetching the information through powershell using the cmdlet Get-Mailbox. The WhenMailboxCreated attribute shows the time when the mailbox was created or license assigned (in office 365). On the other side, the WhenCreated attribute gives time when the mailbox associated AD user or Azure AD user was actually created. So, the value of these two attributes may or may not equal.

WhenMailboxCreated : Gives the time when the mailbox was created.

WhenCreated : The time of when the AD user or Azure AD user of the associated mailbox was created.

So, if you want to get the list of mailboxes that are created in last 7 days. You need to use following powershell command.
Get-Mailbox | Where-Object {$_.WhenMailboxCreated –ge ((Get-Date).Adddays(-7))}
You may get incorrect results when you use whencreated to get mailboxes that are created in past N days. But, you can use below command to get actual AD users who are created in last 7 days.
Get-Mailbox | Where-Object {$_.WhenCreated –ge ((Get-Date).Adddays(-7))}

Advertisements
Advertisements

No comments:

Post a Comment