de-DEen-GB
 
rss

Just can't get enough of IT

This blog is about mostly anything in IT. But the primary focuses are Microsoft Technologies like Exchange, Office 365, Azure and Cloud Security.
On December 11, 2014
1 Comment
2934 Views
Last updated: 2017-10-01 | NOTE: If you are using v2.1 update to v2.13

Exchange Server 2013 Exchange Server 2016 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.

Examples

# 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 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

Version History

  • 2.13 Issue #7 fixed | SendMail switch query
  • 2.11 Issue #6 fixed | Missing Remove-Item cmdlet
  • 2.1 Log file archiving and archive compressions added
  • 2.0 CopyFilesBeforeDelete implemented
  • 1.93 Minor chances to PowerShell hygiene
  • 1.92 .Count issue fixed to run on Windows Server 2012
  • 1.91 Write DaysToKeep to log
  • 1.9 Global functions updated (write to event log)
  • 1.8 Support for global logging and other functions added
  • 1.6 Count Error fixed 1.7 Email report functionality added
  • 1.5 Sorting of server names added and Write-Host output changed
  • 1.4 Handling of IIS default location fixed
  • 1.3 Check if running in elevated mode added
  • 1.2 Auto/Manual configration options added
  • 1.1 Variable fix and optional code added
  • 1.0 Initial community release

Requirements

This PowerShell script requires the GlobalFunctions module, described here.

When using PowerShell 5 or later you can simply use Install-Module GlobalFunctions to install the module to your system.

Links

Additional Credits

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

Follow

 

Read More »

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.

Screenshot showing the PowerShell Execution Policy Error

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.

 

Links

 


Do you plan to deploy Exchange Server 2016 or do you plan go hybrid with Office 365? Check out the enterprise technology services provides by Granikos http://www.granikos.eu/en

Read More »
Last updated: 2016-11-28

Description

The script sends a given number of test email 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.

Examples

# EXAMPLE 1
# Send 10 normal emails
.\Send-TestMail.ps1 -Normal -MessageCount 10

# EXAMPLE 2
# Send an Eicar test email
.\Send-TestMail.ps1 -Eicar

Version History

  • 1.0, Initial community release

Links

Follow

 

Read More »
On October 9, 2014
0 Comment
414 Views

Description

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 webite level, not all settings will be inherited.

Examples

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

Version History

  • 1.0, Initial community release
  • 1.1, PowerShell hygiene applied, some typo fixes

Links

Script last updated: 2016-07-28

Additional Credits

Additional credits go to Michel de Rooij, https://eightwone.com

Follow

Read More »
On September 15, 2014
0 Comment
595 Views

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 varioius 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.

Report and receipt types (Exchange Version independent) used for notification

  • Delivery Receipt (DR)

    Report confirming that a message was delivered to its intended recipient​

  • Delivery Status Notification (DSN)​
    Report describing the result of an attempt to deliver a message

  • Message disposition Notification (MDN)​
    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)​
    Report indicating to the message sender that the message could not be delivered to the intended recipients​

  • Non-Read Notification (NR)
    Report indicating that a message was deleted before is was read, when a read receipt was requested​

  • Out Of Office/Facility (OOF)​
    Report indicating that the recipient will not respond to a new message
    OF referes to the Microsoft original term „out of facility

  • Read Notification (NR)
    Report indicating that a message was read

  • Recall Report​
    Report indicating the status of a recall request for a specific recispient​
    A recall request is used when a sender tries to recall a sent message by using Outlook​

Links

 


This post has first been published in my personal legacy blog here.

Read More »