This is probably what you are looking for http://gallery.technet.microsoft.com/scriptcenter/2fdeaf8d-b164-411c-9483-99413d6053ae
Note it uses bulkcopy and there are some restrictions with that.
Cheers
http://twitter.com/widba
http://widba.blogspot.com/