All Projects → Apoc70 → Purge-LogFiles

Apoc70 / Purge-LogFiles

Licence: MIT License
PowerShell script for Exchange Server 2013+ environments to clean up Exchange and IIS log files.

Programming Languages

powershell
5483 projects

Projects that are alternatives of or similar to Purge-LogFiles

analog-ce
Analog CE
Stars: ✭ 14 (-36.36%)
Mutual labels:  logfile, iis
LogoRRR
A log viewer which visualises log events such that it is easy to identify problems or events of interest. This app was implemented using Scala and JavaFX, GluonHQ toolchain and GraalVM as platform.
Stars: ✭ 40 (+81.82%)
Mutual labels:  logfile
ExchangeAnalyzer
Exchange Analyzer - Checks Exchange Server 2013 or 2016 organizations for common configuration issues and recommended practices.
Stars: ✭ 100 (+354.55%)
Mutual labels:  exchange-server
xExchange
This module contains DSC resources for deployment and configuration of Microsoft Exchange Server.
Stars: ✭ 62 (+181.82%)
Mutual labels:  exchange-server
pytradesimulator
Python based exchange simulator using FIX protocol
Stars: ✭ 20 (-9.09%)
Mutual labels:  exchange-server
IISManager
IIS Manager Extension for Azure Web Apps
Stars: ✭ 29 (+31.82%)
Mutual labels:  iis
redis-matching-engine-server
Implement exchange matching engine by lua script, run in redis
Stars: ✭ 39 (+77.27%)
Mutual labels:  exchange-server
CVE-2021-33766
ProxyToken (CVE-2021-33766) : An Authentication Bypass in Microsoft Exchange Server POC exploit
Stars: ✭ 37 (+68.18%)
Mutual labels:  exchange-server
PowerShellModules
A collection of PowerShell modules
Stars: ✭ 24 (+9.09%)
Mutual labels:  iis
alfredToday
Today menu Plugin for Alfred (generalized for public consumption)
Stars: ✭ 39 (+77.27%)
Mutual labels:  exchange-server
dingir-exchange
A high performance crypto trading engine
Stars: ✭ 169 (+668.18%)
Mutual labels:  exchange-server
iis
Information Inference Service of the OpenAIRE system
Stars: ✭ 16 (-27.27%)
Mutual labels:  iis
hsts-iis-module
IIS module for configuring and injecting the HSTS into IIS sites.
Stars: ✭ 28 (+27.27%)
Mutual labels:  iis
sprout
Golang logging library supporting log retrieval.
Stars: ✭ 85 (+286.36%)
Mutual labels:  logfile
iobroker-logfile-script
Parses log file, applies filters, and sets states for visualization
Stars: ✭ 17 (-22.73%)
Mutual labels:  logfile
mod harbour
Apache mod for Harbour
Stars: ✭ 40 (+81.82%)
Mutual labels:  iis
django-windowsauth
Easy integration and deployment of Django projects into Windows Environments
Stars: ✭ 23 (+4.55%)
Mutual labels:  iis
Remove-DuplicateItems
Script to remove duplicate items from Exchange mailboxes.
Stars: ✭ 32 (+45.45%)
Mutual labels:  exchange-server
jota-cert-checker
Check SSL certificate expiration date of a list of sites.
Stars: ✭ 45 (+104.55%)
Mutual labels:  iis
nuxt-plesk-example
No description or website provided.
Stars: ✭ 27 (+22.73%)
Mutual labels:  iis

IMPORTANT NOTE

Update to most current release if you are using v2.1

Purge-LogFiles.ps1

PowerShell script for modern Exchange Server environments to clean up Exchange Server and IIS log files.

Description

This script deletes all Exchange Server 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 a variable and used to build an administrative UNC path for file deletions. It is assumed that the Exchange setup path is IDENTICAL across all Exchange servers.

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

The IIS log file location is read from the local IIS metabase of the LOCAL server and is used to build an administrative UNC path for IIS log file deletions.

Currently, it is assumed that the IIS log file location is identical across all Exchange servers.

Requirements

  • Windows Server 2012 R2 or newer
  • Utilizes the global function library found here: http://scripts.granikos.eu
  • AciveDirectory PowerShell module
  • Exchange Server 2013+
  • Exchange Management Shell (EMS)

Updates

  • 2020-05-14, v2.3.1, Issues #14, #15 fixed to properly support Edge Transport Role
  • 2020-03-12, v2.3, Option for HTTPERR added, Option for dynamic Exchange install paths added, Html formatting added, tested with Exchange Server 2019

Parameters

DaysToKeep

Number of days Exchange and IIS log files should be retained, default is 30 days

Auto

Switch to use automatic detection of the IIS and Exchange log folder paths

IsEdge

Indicates the the script is executed on an Exchange Server holding the EDGE role. Without the switch servers holding the EDGE role are excluded.

IncludeHttpErr

Include the HTTPERR log files in the purge routine. Those logs are normally stored at C:\Windows\System32\LogFiles\HTTPERR.

UseDynamicExchangePaths

Determine the Exchange install path by querying the server object in AD configuration partition. This helps if your Exchange servers do not have a unified install path across all servers.

RepositoryRootPath

Absolute path to a repository folder for storing copied log files and compressed archives. Preferably an UNC path. A new subfolder will be created for each Exchange server.

ArchiveMode

Log file copy and archive mode. Possible values

  • None = All log files will be purged without being copied
  • CopyOnly = Simply copy log files to the RepositoryRootPath
  • CopyAndZip = Copy logfiles and send copied files to compressed archive
  • CopyZipAndDelete = Same as CopyAndZip, but delete copied log files from RepositoryRootPath

SendMail

Switch to send an Html report

MailFrom

Email address of report sender

MailTo

Email address of report recipient

MailServer

SMTP Server for email report

Examples

.\Purge-LogFiles -DaysToKeep 14

Delete Exchange and IIS log files older than 14 days

.\Purge-LogFiles -DaysToKeep 7 -Auto

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

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

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

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

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.ps1 -DaysToKeep 7 -SendMail -MailFrom postmaster@sedna-inc.com -MailTo exchangeadmin@sedna-inc.com -MailServer mail.sedna-inc.com -UseDynamicExchangePaths -IncludeHttpErr

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.

Note

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.

Credits

Written by: Thomas Stensitzki

Stay connected

For more Office 365, Cloud Security, and Exchange Server stuff checkout services provided by Granikos

Additional Credits

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].