Giter Site home page Giter Site logo

ittchmh / purge-logfiles Goto Github PK

View Code? Open in Web Editor NEW

This project forked from apoc70/purge-logfiles

0.0 1.0 0.0 31 KB

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

Home Page: https://www.granikos.eu/en/justcantgetenough/PostId/208/purge-exchange-server-and-iis-log-files

License: MIT License

PowerShell 100.00%

purge-logfiles's Introduction

IMPORTANT NOTE

Update to v2.11 if you are using v2.1

Purge-LogFiles.ps1

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

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 adminstrative UNC path for file deletions.

It is assumed that the Exchange setup path is IDENTICAL across all Exchange servers.

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.

It is assumed that the IIS log file location is identical across all Exchange servers

Requirements

  • Exchange Server 2013+
  • Exchange Management Shell (EMS)

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

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

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.

TechNet Gallery

Download and vote at TechNet Gallery

Credits

Written by: Thomas Stensitzki

Stay connected:

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

Additional Credits:

purge-logfiles's People

Contributors

apoc70 avatar denisvm avatar jazzl0ver avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.