Email Notification Script or Command Help ifnay New room mailbox Created

Ramki 796 Reputation points
2021-12-24T07:07:56.48+00:00

Dear All

Am looking for a command, or script to notiffy me, if any one created a new room maibox in exchange environment . My environmemnt is hrybbied exchnage 2016.

check if nay room mailbox created in last 24 hours , and then send an email to me , if any room mailbox created in last 24 hours.

Exchange Online
Exchange Online

A cloud-based service included in Microsoft 365, delivering scalable messaging and collaboration features with simplified management and automatic updates.

Exchange | Exchange Server | Management
Exchange | Exchange Server | Management

The administration and maintenance of Microsoft Exchange Server to ensure secure, reliable, and efficient email and collaboration services across an organization.

Exchange | Hybrid management
Exchange | Hybrid management

The administration of a hybrid deployment that connects on-premises Exchange Server with Exchange Online, enabling seamless integration and centralized control.

0 comments No comments

2 answers

Sort by: Oldest
  1. Andy David - MVP 160.2K Reputation points MVP Volunteer Moderator
    2021-12-24T13:20:41.247+00:00

    Create a scheduled task that connects to Exchange and runs once a day:

    $NewMailboxes = Get-Mailbox -ResultSize unlimited  -RecipientTypeDetails RoomMailbox  |?{$_.WhenMailboxCreated -gt (get-date).AddHours(-24)}
    
    $Report = (
    
    $NewMailboxes.userprincipalname|
    Sort-Object UserPrincipalname |
    ft -AutoSize |
    Out-String
    
    
    
    )
    $count = ($NewMailboxes).Count
    if ($($NewMailboxes | measure).Count -gt 0) {send-mailmessage -to ******@contoso.com -smtpserver **yourMailServer** -subject " $count Room Mailboxe(s) Created in the last hour" -From 
    ******@contoso.com -Body $Report}
    

    Was this answer helpful?


  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    7 deleted comments

    Comments have been turned off. Learn more

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.