So basically a pal of mine at an old job was complaining that he couldn't figure out a good way to do this. I wrote two ways to do it: one in Powershell and one in C#.