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:

[codesyntax lang="powershell"]

Set-MailboxAutoReplyConfiguration -Identity -AutoReplyState Enabled -ExternalMessage "message with whatever autoreply" -InternalMessage "internal something autoreply"


How do I disable this?

[codesyntax lang="powershell"]

Set-MailboxAutoReplyConfiguration -Identity -AutoReplyState Disabled


  1. This is the best quick to the point blog i've got as i've been looking for this code.


  2. Great post, but some of the colors in your codeblock are too light

  3. 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)

  4. 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?)

    • Hi John, what did you use in the end to set a group of mailboxes OOO ?


      • 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.

  5. Hasan Salciav

    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.

  6. if i have massage
    Set-MailboxAutoReplyConfiguration -Identity -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.

    User Name"

    how can i do next row?

Scrie si tu o vorbulita

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

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