How to add an Out of Office message in Office 365 using powershell

I know it's a simply task to do from OWA, but if you want to add an Out of Office message for another user, you will have to reset it's password, login into OWA and setup the message there. But I don't want to reset the user's password. So, after connecting to office 365, use the following commands:

Set-MailboxAutoReplyConfiguration -Identity user@example.com -AutoReplyState Enabled -ExternalMessage "message with whatever autoreply" -InternalMessage "internal something autoreply"

How do I disable this?

Set-MailboxAutoReplyConfiguration -Identity user@example.com -AutoReplyState Disabled

8 thoughts on “How to add an Out of Office message in Office 365 using powershell”

  1. Can you do this for a group of mailboxes from a csv ? I’d like to be able to export the list first into a table and then live edit the selection, but i guess that’s why code two sell their Application which does that. It’s been buggy for me hence the reason for looking at powershell options.
    e.g using your calendar powershell code could it not be modified ?

    Or if everyone has to have the OOF then you could use the exact code i assume?
    $allmailbox = Get-Mailbox -Resultsize Unlimited
    Foreach ($Mailbox in $allmailbox)
    ….

  2. Just to clarify an update from code two via tech support helped greatly. They are great at free support during trial period as well. I’ve got more work to do for every consideration my boss wants though…

    I’ve however managed to get the loop of mailboxes working. Happy to share when asked ( if comments are emailed?)

      1. Since the job I was doing was a 1-off, I just went into o365 control panel and exported all the shared mailboxes. Then I used regex to replace everything before the users e-mail address with “Set-MailboxAutoReplyConfiguration -Identity “” and everything after the user’s e-mail address with “” -AutoReplyState Enabled -ExternalMessage “YourMessageHere” -InternalMessage “YourInternalMessageHere”

        I’m still looking for a proper solution to do this dynamically by looking at the mailbox object attributes so I don’t have to do this manually though.

  3. You can also scheduled the message.

    –AutoReplyState Scheduled -StartTime “03/12/2018 05:00” -EndTime “03/12/2018 18:00”

    Note: This date is 12 March 2018 and time is +0. You should calculate your time. For example: If you are in +3 time zone and you want to start the message at 09:00, you should write the time 06:00.

    And also you can customise the message with html and css codes.

  4. if i have massage
    Set-MailboxAutoReplyConfiguration -Identity UserName@Daomin.com -AutoReplyState Enabled -ExternalMessage “message with whatever autoreply” -InternalMessage “I’m currently Out Of the Office with limited access to my email until Thursday, 5.5.
    For anything urgent – please send me a Whatsapp message.

    Thanks,
    User Name”

    how can i do next row?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.