Searching for an EnvironmentVariable using Contains() is case sensitive - GetEnvironmentVariable() is not case sensitive, so switching to that form.