Added --generate and --password flags.

Try to revert the password if the environinfo write fails