param( [string]$Identity ) try { $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 $config = Get-MailboxAutoReplyConfiguration -Identity $Identity $config | Format-List Write-Host "AutoReply configuration retrieved successfully for $Identity." -ForegroundColor Green Remove-PSSession $session } catch { Write-Host "Failed to retrieve AutoReply configuration for $Identity. Error:" -ForegroundColor Red Write-Host $_ }