Pre-heat oven to 350°F.
Spray a 2-quart glass baking dish, or an 8-inch aluminum pan, with cooking spray.
In a large bowl, combine potatoes, soup, cheese, sour cream, onions and ¼ cup butter; mix well; spread into prepared baking dish.
In a small bowl, stir together cornflakes and 2 tablespoons margarine or butter.
Spread topping evenly over hash browns.
Bake 45 minutes or until hash browns are tender.