Found this the other day - for when you're restoring SQL databases. You need to kick out all current users right?
Run this little fella into your master database and away you go - just run this step before your restore.