Useful PowerShell Scriptlets for Files and Folders

What is the best way to learn PowerShell? Never use cmd.exe again! With PowerShell 2.0 on my Windows 7 machine I decided it finally is time to polish my rusty knowledge of the language dating back to the days when PowerShell was still called Monad. In my attempt to re-familiarize myself with PoSh I consciously use it for tasks that would take me mere seconds with other tools like cmd.exe, or even old friends like Perl. But, hey, learning takes time, and there is nothing better than practice! Here are a couple of things I have learned en route.
Scripting

Cleaning up the Mess Left Behind by Multiple EFS Certificates

In case you have (un?)wittingly been juggling around with multiple EFS certificates like me, you may feel a strong urge to clean up the mess. Which mess? It can happen quite easily that different files are encrypted with different keys. In addition to that, directories that are marked for encryption have EFS certificates associated with them, and there is no UI to manipulate that. In order to straighten this out, once the proper certificate is in place each file and directory needs to be “touched” in order to update their encryption keys.
Tips and Tools