param( [string]$Identity ) try { # Import admin credentials $serverAddress = Get-Content -Path ".\DefaultServer.txt" $credential = Import-Clixml -Path ".\AdminCredential.xml" $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://$serverAddress/PowerShell/ -Authentication Kerberos -Credential $credential Import-PSSession $session -DisableNameChecking # Clear the content of AutoReply messages for the specified mailbox Set-MailboxAutoReplyConfiguration -Identity $Identity -InternalMessage "" -ExternalMessage "" Write-Host "AutoReply messages cleared for $Identity." -ForegroundColor Green # Remove the session Remove-PSSession $session } catch { Write-Host "Failed to clear AutoReply messages for $Identity. Error:" -ForegroundColor Red Write-Host $_ }