July 2017
Intermediate to advanced
648 pages
31h 9m
English
The WhenMailboxCreated property returns a DateTime object that can be compared to other DateTime objects. In the previous example, we used the following filter with the Where-Object cmdlet:
$_.WhenMailboxCreated –ge (Get-Date).AddDays(-7)
When running the Get-Date cmdlet without any parameters, a DateTime object for the current date and time is returned. Every DateTime object provides an AddDays method that can be used to create a new DateTime object. So, to get the DateTime object from 7 days ago, we simply provide a negative value when calling this method, and the result is the date and time from a week ago. We compare the WhenMailboxCreated date to this value and if it is greater than or equal to the date 7 days ago, ...
Read now
Unlock full access