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

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

Leave a Reply

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