Yes, it's been solved a million times, but Chances are that people have solved it in ways that won't make you happy.
Your best bet is the Microsoft Technet Script Center and it's Script Center Repository. With those you will find the pieces needed to do it yourself. Another great resource is the "Windows 2000 Scripting Guide", a Microsoft Publication. The physical book is huge but cheaply-found, but I think that MS offers an electronic copy freely. (Online Version here.)
The pieces of code that you'd need to leverage are well-documented; Chances are that you just need to assemble the pieces!
But by all means, open-source what you do!