Set the environment before querying the registry.