Updated script to try and automatically detect OS & Version.