Page 1 of 1

Setup an Out Of Office text reply for disabled AD account

Posted: Mon May 20, 2013 1:03 pm
by bareedaa
I would like to Setup auto an Out Of Office text reply for disabled active directory account(whenever the employee is terminated)using powershell. I need to have auto reply whenever the user account/mailbox user with in active directory is disabled.
I have the following script to automate but it is not working. Please help:

foreach($_ in (Get-ADUser -SearchBase "$_.recipienttypedetails -eq "usermailbox" -Filter {Enabled -eq $false})){
Set-MailboxAutoReplyConfiguration -Identity $_.DistinguishedName -AutoReplyState Enabled
-ExternalAudience All -InternalMessage "Your message to internal users" -ExternalMessage "Your message to external users" }

Re: Setup an Out Of Office text reply for disabled AD accoun

Posted: Mon May 20, 2013 2:09 pm
by jvierra
You seem to be a little lost with the use of PowerShell syntax.

This might help a bit:
PowerShell Code
Double-click the code block to select all.
Get-ADUser  -Filter {Enabled -eq $false}  -Searchbase 'OU=MyOU,Dc-domain,DC=com' |
     ForEach{
          Set-MailboxAutoReplyConfiguration -Identity $_ `
                                            -AutoReplyState Enabled `
                                            -ExternalAudience All `
                                            -InternalMessage 'Your message to internal users' `
                                            -ExternalMessage 'Your message to external users'
     }