Here are various scripts you may find useful. Nothing complicated if you have even basic scripting knowledge.