File Integrity Monitoring is a process of ensuring files are maintaining their integrity. This is to ensure that they have not been changed or tampered with in an unauthorized way. For example, with FIM, you could have alerts sent to you if critical system files have been changed without your consent. If critical system files have been changed without your consent, that could mean that you have a malware, an attacker, etc.
Why would you want File Integrity Monitoring system/application? Here’s why:
- It allows you to detect security breaches or malware early before they cause too much damage
- Improves your incident response time
- Visibility into changes that have been made to critical files
So today with PowerShell, we are making a basic FIM (File Integrity Monitor.) I will be breaking down the script








If the file path does not exist in the dictionary, it will assume that a new file has been created and it will alert the user that a new file has been created in green text.
If the a file has been changed it will assume the file has been compromised and will notify the user that the file has been changed in yellow text. It does this by constantly checking back every 1 second with the baseline.txt and making sure that the filepath and the corresponding hash values in the files directory matches with the ones in the dictionary we made.

There are lots of ways to make this script a lot better or more realistic, such as instead of notifying the user in the console, it could send you an email, or send you a text. I tried making it send an email, the script had a few syntax errors that I was able fix but I couldn’t figure out why it wasn’t sending the emails. Maybe a port is blocked? Or a firewall is somehow stopping this action? Not sure.
In conclusion, File Integrity Monitoring is to ensure that important files have not been changed or tampered with in an unauthorized way, and can greatly improve security as your team can lower their incident response time, further lowering the chances of a costly security breach.