Copy IIS or transport protocol log files from Exchange 2013/2016/2019 Servers to a single location for better log file analysis.
This script copies IIS log or other selected Exchange log files from all Exchange servers to a single target root folder creating subfolders for each source server.
The log files need to have the same root folder across all Exchange 2013/2016/2019 servers.
The script is intended to run from within an active Exchange 2013/2016/2019 Management Shell session.
- Windows Server Windows Server 2012 R2+
- Exchange Server 2013/2016/2019 Management Shell
- Utilizes global functions library
Number of days IIS log files should be gatheredretained, default is 1 day
Local IIS log file root to store copied log files, default E:\GatheredLogs
Switch to delete per Exchange Server subfolders and creating new folders
Switch to gather IIS log files from all Exchange 2013/2016/2019 servers. Creates a subfolder named 'IIS'.
Switch to gather Hub transport SMTP protocol logs from all Exchange 2013/2016/2019 servers. Creates a subfolder named 'Hub'.
Switch to gather Frontend transport SMTP protocol logs from all Exchange 2013/2016/2019 servers. Creates a subfolder names 'Frontend'.
Switch to gather EWS protocol logs from all Exchange 2013/2016/2019 servers. Creates a subfolder names 'EWS'.
.\Get-Logs.ps1 -IIS
Copy IIS Frontend and Backend W3SVC log files
.\Get-Logs.ps1 -CleanFolders -IIS
Delete local subfolders and copy IIS log files
.\Get-Logs.ps1 -CleanFolders -FrontendTransport -DaysToFetch 5
Delete local subfolders and copy frontend transport logs for the last 5 days
THIS CODE IS MADE AVAILABLE AS IS, WITHOUT WARRANTY OF ANY KIND. THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS CODE REMAINS WITH THE USER.
Written by: Thomas Stensitzki
- My Blog: http://justcantgetenough.granikos.eu
- Twitter: https://twitter.com/stensitzki
- LinkedIn: http://de.linkedin.com/in/thomasstensitzki
- Github: https://github.com/Apoc70
- MVP Blog: https://blogs.msmvps.com/thomastechtalk/
- Tech Talk YouTube Channel (DE): http://techtalk.granikos.eu
For more Office 365, Cloud Security, and Exchange Server stuff checkout services provided by Granikos
- Blog: http://blog.granikos.eu
- Website: https://www.granikos.eu/en/
- Twitter: https://twitter.com/granikos_de