Using Powershell to generate eventviewer statistics and event exports

During FIM health checks we need to have a good overview of the event viewer on the FIM Servers.
In almost any case the event viewer is a good measure of the server’s health.

The more red and yellow you see, the more errors and warnings, the more work you’ll have to get your server in a healthy state.

First goal is to have a general temperature of the health.
Second goal is to have the details to fix the issues.

I’ve created a Powershell to analyse the event viewer logs.

Instead of posting the Powershell in this blog, I’ve published it on TechNet Gallery, over here:

There is a companion Wiki article with some guidance and configuration manual.

In short, the Powerscript below is a modular script that offers following functions:

  • display the event log properties
  • analyse number of events per category
  • analyse number of events per severity
  • overview of error events with source, severity and sample message
  • detailed list of last event per eventID

You can configure the script:

  • choice of event logs
  • history length (period of events to report on)
  • enable/disable logging
  • enable/disable result export to file


Before you start

  • validate your script execution policy
  • copy the script to a separate folder where you can execute the script
  • validate the script parameters

Script configuration parameters

  • $enableLogging
    • $TRUE = create a transcript of the script during run (does not work in ISE)
    • $FALSE = do not create a verbose log
  • $ExportEnabled
    • $FALSE = do not export the result to file
    • $TRUE = export the results, statistics and event details to file
  • $EventLogList
    • Default: ‘System’,’Application’,’Setup’,’Forefront Identity Manager’,’Forefront Identity Manager Management Agent’
  • $startdate
    • Defines from which point in time the event logs must be analysed
    • HINT: on a system with a large size of event logs, it’s advised to limit the history to x days or x weeks. A large volume event log will impact the usage of script memory.

I’m more than happy if you would test the script and provide me feedback to improve the script.



TechNet Wiki Summit – Calling IT Professionals | Register Now! #TNWIKISummit15


The International TechNet Wiki Summit 2015 aka TNWiki Summit15 will be a landmark in the TechNet Wiki history!

This Summit edition will be a unique conference to be held by Community members, based only on TechNet Wiki articles created to share problems and solutions, providing the opportunity to acquire knowledge and strengthen contacts between IT Professionals and Developers, to improve their professional growth.

Let’s thank what has been accomplished on TechNet Wiki and encourage Attendees to share ideas and knowledge about different articles.

Note-to-self: Internet, privacy and copyright (blogs, #TNWIKI, …)

While working on TechNet Wiki Governance, I stumbled into some useful links.

Saving it to my external memory for quick reference:

How to Use PowerShell to create a TN Wiki catalog page

While the Microsoft Technet Forums have become the base for a very vibrant community, it’s not really THE platform to build, share and maintain documentation.

The Technet Wiki fans know that the TNWiki is a very interesting platform that perfectly complements the Technet Forums for that purpose.

Most of the people publishing on the Technet Wiki like to get an overview of their articles, once in a while.
Although the Wiki offers nice features, it’s very hard to get a concise, quick overview of your articles.

One of the tricks to achieve this, is using a personal tag. (eg. pgtag 😉
But as you can see, its not a condensed view.

Therefore I created a powershell script that does it for you.

Just take a look at this page: How to Use PowerShell to create a Wiki catalog page (feel free to copy the code and use offline for customization)

Another example (pure results of the script) is the list below:

Current ADFS Resources (Peter Geelen, 17 feb 2011)
Current Certificate Lifecycle Manager Resources (Peter Geelen, 24 sep 2010)
Current Identity Lifecycle Manager resources (Peter Geelen, 5 apr 2010)
FIM 2010 Software Solutions from Partners (Peter Geelen, 31 okt 2010)
FIM 2010 Wiki Articles (Peter Geelen, 5 jul 2011)
Forefront Identity Manager (FIM) 2010 Webcasts and Videos (Peter Geelen, 19 jul 2010)
Forefront Identity Manager Resources (Peter Geelen, 15 mrt 2010)
Get Help with ILM and FIM (Peter Geelen, 24 nov 2010)
How to Automate FIM 2010 Sync Engine Run Profile Execution (Peter Geelen, 7 dec 2010)
How to Automatically Add a Table of Contents (TOC) to Your Wiki Article (Peter Geelen, 30 mei 2011)
How to Extend the GALSync to Provision Target Objects in Sub OUs Using a Configuration File (Peter Geelen, 7 nov 2010)
How to License FIM 2010 (Peter Geelen, 17 mrt 2011)
How to Post an ILM Experts Corner Article Announcement (Peter Geelen, 28 nov 2010)
How to Set Trace for ERPMA (Peter Geelen, 9 mrt 2010)
How to Solve SQL MA Schema Update Error: ‘Attribute ‘<deleted attribute>’ could not be located in the schema’ (Peter Geelen, 22 jun 2010)
How to Use PowerShell to create a Wiki catalog page (Peter Geelen, 19 sep 2011)
ILM : How to Get Attribute Data from a Referenced Object (Peter Geelen, 7 jun 2010)
ILM 2007 FP1 / FIM 2010 Synchronization Glossary (Peter Geelen, 11 jul 2010)
ILM ERPMA with SAPRouter (Peter Geelen, 9 mrt 2010)
ILM/FIM Forum Playbook (Peter Geelen, 21 feb 2011)
ILM/FIM Run Profile Definitions (Peter Geelen, 6 jul 2010)
Troubleshooting ILM Group Populator Language Dependencies (Peter Geelen, 9 jun 2010)
Troubleshooting ILM/FIM Extensions (Peter Geelen, 24 nov 2010)
Troubleshooting ILM/MIIS with SAP Load Balancing Connection String (Peter Geelen, 9 mrt 2010)
Troubleshooting PCNS (Peter Geelen, 13 okt 2010)