Website-Icon Granikos GmbH & Co. KG

Purge Exchange Server and IIS Log Files

Last updated: 2020-03-12 | NOTE: If you are still using v2.1 update to themost recent 

Description

This script deletes all Exchange and IIS logs older than X days from all Exchange 2013+ servers that are fetched using the Get-ExchangeServer cmdlet.

The Exchange log file location is read from the environment variable and used to build an administrative UNC path for file deletions.

Optionally, you can use the Active Directory configuration partition to determine the Exchange install path dynamically, if supported in your Active Directory environment.

Examples

# EXAMPLE 1
# Delete Exchange and IIS log files older than 14 days 

.\Purge-LogFiles -DaysToKeep 14

# EXAMPLE 2
# Delete Exchange and IIS log files older than 7 days with automatic discovery

.\Purge-LogFiles -DaysToKeep 7 -Auto

# EXAMPLE 3
# Delete Exchange and IIS log files older than 7 days with automatic discovery and send email report

.\Purge-LogFiles -DaysToKeep 7 -Auto -SendMail -MailFrom postmaster@sedna-inc.com -MailTo exchangeadmin@sedna-inc.com -MailServer mail.sedna-inc.com

# EXAMPLE 4
# Delete Exchange and IIS log files older than 14 days, but copy files to a central repository and compress the log files before final deletion

.\Purge-LogFiles -DaysToKeep 14 -RepositoryRootPath \\OTHERSERVER\OtherShare\LOGS -ArchiveMode CopyZipAndDelete

# EXAMPLE 5
# Delete Exchange Server, IIS, and HTTPERR log files older than 7 days, and send an HTML email. Identify Exchange file paths using AD configuration objects

.\Purge-LogFiles.ps1 -DaysToKeep 7 -SendMail -MailFrom postmaster@sedna-inc.com -MailTo exchangeadmin@sedna-inc.com -MailServer mail.sedna-inc.com -UseDynamicExchangePaths -IncludeHttpErr

Version History

Requirements

Links

Additional Credits

Brian Reid, C7 Solutions, http://www.c7solutions.com/2013/04/removing-old-exchange-2013-log-files-html

Follow

Kurz-URL | Short URL: https://granikos.eu/go/eJyA
Die mobile Version verlassen