cdwyersandysecondary Posted October 21, 2021 Posted October 21, 2021 Hi all, The head has asked that we enable an 'out of office' for all staff over half term. We use O365, is this doable? Many thanks
FN-GM Posted October 21, 2021 Posted October 21, 2021 Hello, It is possible with Powershell. This should get you started: https://docs.microsoft.com/en-us/powershell/module/exchange/set-mailboxautoreplyconfiguration?view=exchange-ps
psydii Posted October 21, 2021 Posted October 21, 2021 something like (extremely rough pseudo code follows) $internalmessage = get-content internalmessage.txt $externalmessage = get-content externalmessage.txt for each $user in (get-aadusers -filter by staff) { Set-MailboxAutoReplyConfiguration $user.emailaddress -AutoReplyState enabled -ExternalAudience -InternalMessage "$internalmessage" -ExternalMessage "$externalmessage" }
psydii Posted October 21, 2021 Posted October 21, 2021 (edited) Untested. A little less pseudo code and abit more gung-ho "just do it" attitude. connect-azuread connect-exchangeonline $internalmessage = get-content internalmessage.txt $externalmessage = get-content externalmessage.txt $AllStaff = Get-AzureADGroupMember -ObjectId (Get-AzureADGroup -SearchString "all staff").objectid foreach ($colleague in $allstaff) { Set-MailboxAutoReplyConfiguration -identity $colleague.userprincipalname -AutoReplyState enabled -ExternalAudience -InternalMessage "$internalmessage" -ExternalMessage "$externalmessage" } You might want to check users who already have autoreply configured with get-mailboxautoreplyconfiguration first. Edited October 21, 2021 by psydii
TechMonkey Posted October 21, 2021 Posted October 21, 2021 Here is the code I used over lockdown to set furloughed staff OoO Connect-AzureAD Connect-EXOPSSession -UserPrincipalName USER@DOMAIN $group = Get-AzureADGroup -SearchString "furloughedStaff" $members = Get-AzureADGroupMember -ObjectId $group.ObjectId -All $true | Where-Object {$_.ObjectType -eq "User"} $OOFMsg = "EMAIL CONTAINING HTML FORMATTING" foreach ($member in $members.UserPrincipalName){ Set-MailboxAutoReplyConfiguration -Identity $member -AutoReplyState Enabled -InternalMessage $OOFMsg -ExternalMessage $OOFMsg }
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now