ConfigMgr Log Sanitizer Powershell Script

Do you ever need to email or post ConfigMgr log files or snippets online for blogs or support? I know I do. I wanted to have a way to consistently clean log files quickly, so I wrote a small PowerShell script to help. It’s nothing special – the hardest part is figuring out which regular expressions work best for each data type you want to replace. I ended up with 4 regular expressions that work well for the smsts.log. Here are the 4 types and examples of log file entries before and after each regex:

  1. Server Name

    SCCM Site Code

    URLs with domain names

    Specific words unique to your company

    #Be sure to test your regular expressions. There are several online test tools available.

I’ve added the file to my GitHub repository (first one yay!!) here: https://github.com/AdamGrossTX/PowershellScripts/blob/master/PSLogSanitizer.ps1.

Let me know if you have any suggestions for improvements.

You Might Also Like

No Comments

Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.