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.
# EXAMPLE 1
# Delete Exchange and IIS log files older than 14 days
.\Purge-LogFiles -DaysToKeep 14
# EXAMPLE 3
# 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 email@example.com -MailTo firstname.lastname@example.org -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 email@example.com -MailTo firstname.lastname@example.org -MailServer mail.sedna-inc.com -UseDynamicExchangePaths -IncludeHttpErr
Brian Reid, C7 Solutions, http://www.c7solutions.com/2013/04/removing-old-exchange-2013-log-files-html
Uninstalling Exchange Server 2013 will fail if the PowerShell MachinePolicy or UserPolicy is set by GPO.
You will receive an error message referencing Microsoft KB article 981474, which refers primarily to Exchange Server 2010.
The following PowerShell command removes the GPO setting.
Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\PowerShell -Name ExecutionPolicy –Value ""
After setting the ExecutionPolicy attribute to an empty string, Exchange Server 2013 can be uninstalled successfully.
Do you plan to deploy Exchange Server 2016 or do you plan to go hybrid with Office 365?
Check out the enterprise technology services provides by Granikos http://www.granikos.eu/en
The script sends a given number of test emails to a configured SMTP host for test purposes (primarily Exchange queues, transport agents, or anti-virus engines).
Do not forget to adjust script variables to suit your local Exchange infrastructure.
# EXAMPLE 1
# Send 10 normal emails
.\Send-TestMail.ps1 -Normal -MessageCount 10
# EXAMPLE 2
# Send an Eicar test email
This script reconfigures the IIS log folder to use a different folder instead of the default C:\inetpub\logs folder.
Additionally, the log settings can be adjusted as well. The script changes the default log file location and settings on a server level.
By default, the settings are inherited by websites. If manual changes have been made on a website level, not all settings will be inherited.
Change the IIS log file location to D:\IISLogs
.\Set-Webserver.ps1 -LogFolderPath D:\IISLogs
Change the IIS log period to an hourly period
.\Set-Webserver.ps1 -LogFilePeriod Hourly
Use the local time for filenames and log file rollover
.\Set-Webserver.ps1 -LocalTimeRollover $true
Additional credits go to Michel de Rooij, https://eightwone.com
Exchange and other MTAs use DSNs (Delivery Status Notifications) and NDRs (Non-Delivery Reports) to notify the sender or sending MTAs (Message Transfer Agents aka Mail Servers) about the various statuses of a given email message. In Exchange, those messages are generated primarily by the categorizer component of the transport service.
You can use the New-SystemMessage cmdlet to create new messages. These messages can even be localized and can contain Html tags for properly styled notifications.
From a system perspective, the various notifications used are named and fulfill a specific purpose.
Delivery Status Notification (DSN)
A report describing the result of an attempt to deliver a message
Message Disposition Notification (MDN)
A report describing the status of a message after it has been successfully delivered to a recipient. Examples: read notification (RN) or non-read notification (NRN)
Defined by RFC 2298 and controlled by Disposition-Notification-To header
Non-Delivery Report (NDR)
A report indicating to the message sender that the message could not be delivered to the intended recipients
Non-Read Notification (NRN)
A report indicating that a message was deleted before it was read when a read receipt was requested
Out Of Office/Facility (OOF)
A report indicating that the recipient will not respond to a new message
OOF refers to the Microsoft original term „out of facility“
Read Notification (RN)
A report indicating that a message was read
Recall Report (RR)
A report indicating the status of a recall request for a specific recipient
A recall request is used when a sender tries to recall a sent message by using Outlook
This post has first been published in my personal blog here.