While looking why I was running running short on disk space, I noticed that my IntelliTrace file directory was very large. The default option for debugging with IntelliTrace is to delete the .iTrace file as soon as you stop debugging. I feel it is better to always save the files because that one time you need to look at the IntelliTrace event flow after the fact could save the day. You can configure IntelliTrace to save the .iTrace files by going to the Visual Studio options dialog, IntelliTrace, Advanced page and checking the “Store IntelliTrace recordings in this directory” check box.

What’s supposed to happen is when you exit Visual Studio, it will clean up the .iTrace file directory. In most cases it does, but there seem to be a few cases where the delete doesn’t happen. Since I didn’t want to waste a gigabyte of space on my SSD drive I put together a new cmdlet in my WintellectPowerShell module called, amazingly enough, Remove-IntelliTraceFiles. That cmdlet will run through your storage directory and delete any lingering files for you automatically.

In writing Remove-IntelliTraceFiles, I needed to check if a registry value was set to know if you had set VS to save the .iTrace files. Since Test-Path doesn’t work on checking if property values (maybe a feature for PowerShell 4?) I included Test-PathReg to make value checking easier. Full credit for Test-PathReg goes to Can Dedoeglu, whose blog I found it on.

If you’d like the updated WintellectPowerShell, visit it’s home on GitHub: https://github.com/Wintellect/WintellectPowerShell.