Preheat oven to 350 degrees F and grease a 9x13 inch baking dish with cooking spray. Set aside.
Melt butter in a non-stick sauté pan over medium heat.
Add in onions, salt, and pepper and cook, stirring regularly, for 5 minutes or until slightly softened.
Pour onion mixture into a large bowl and add in sour cream, cream of mushroom, and shredded cheese.
Stir to combine.
Add in frozen shredded hashbrowns and mix, breaking up any large chunks as you go, until well combined.
Pour into prepared baking dish.
Bake in preheated oven for 1 hour.
Sprinkle with crushed cornflakes, then gently press down on the cornflakes so they stick to the potatoes - be careful to not touch the hot pan.
Spray the top generously with cooking spray.
Bake for an additional 10 minutes.
Cool slightly, serve, and enjoy!
Take 5 seconds to . We greatly appreciate it!