How to get only O365 deleted users for a specific day?

SAM2009
SAM2009 used Ask the Experts™
on
Hi,

How can I filter this PowerShell cmd by date to get only O365 deleted users for a specific day?

Get-MsolUser  -ReturnDeletedUsers

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2015
Distinguished Expert 2018
Commented:
There are no built-in filters for that, so you have to do it client-side. Here's an example:

Get-MsolUser -ReturnDeletedUsers | ? {$_.SoftDeletionTimestamp -gt '25 Jun 2018'}

Open in new window

Just to expand on Vasil's post, I would suggest converting to the below as this will check the date is equal to the specified date,

Get-MsolUser -ReturnDeletedUsers | Where-Object {$_.SoftDeletionTimestamp.Date -eq (Get-Date '26 Jun 2018')}

Open in new window

Author

Commented:
Thanks Robin but what  dot date means in: SoftDeletionTimestamp.Date?
Hi Sam,

That just takes the date do removes the time making it midnight, makes finding things by date easier

Cheers robin

Author

Commented:
Thanks for your help!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial