I was given the task to rewrite the login script for a company, they had 4 sites and about 20 login scripts for various purposes.
So I wrote a general one which took care of all the general stuff.
You may look at my earlier post about an inventory script, because this script will use that one.