Preheat oven to 350 degrees F°. Spray a 9×13 inch baking dish with cooking spray.
In a large bowl, mix together cream of mushroom soups, sour cream, onion and 1+1/2 cups of the shredded cheese. Mix together well. Season with salt and pepper.
Add in frozen hashbrowns, and chopped ham (if using) and mix all together well. Pour mixture into the prepared baking dish.
Bake uncovered, for 45 minutes.
While potatoes are baking, mix together the crushed corn flakes, melted butter and the last 1/2 cup of shredded cheese.
When potatoes are done, remove from oven and sprinkle the top evenly with the corn flake mixture. Place back into oven and bake another 15 minutes or until top is golden and bubbly. Let stand 5-10 minutes before serving.