How do you enable IMAP functionality and protocol logging on an Exchange server using PowerShell?
To enable IMAP on Exchange, start the IMAP4 services with `Start-Service MSExchangeIMAP4; Start-Service MSExchangeIMAP4BE`, set them to automatic startup, and configure external connection settings with `Set-ImapSettings`. For logging, run `Set-ImapSettings -ProtocolLogEnabled $true` and restart the services. Logs are saved by default to `C:\Program Files\Microsoft\Exchange Server\V15\Logging\Imap4`. These steps are detailed in the Penetration Basics - Reading Emails Using the IMAP Protocol article.
ExchangeIMAP enablePowerShellprotocol loggingSet-ImapSettings