Preheat oven to 350°F and grease a 9x13-inch baking dish.
Boil diced potatoes in salted water for 8-10 minutes until just tender, then drain well.
In a large bowl, combine cream of mushroom soup, sour cream, 1 1/2 cups cheddar cheese, milk, onion, garlic powder, and pepper.
Add potatoes and ham to the soup mixture and stir until everything is well coated.
Pour mixture into prepared baking dish and spread evenly.
Mix crushed cornflakes with melted butter and remaining 1/2 cup cheese, then sprinkle over casserole.
Cover with foil and bake for 45 minutes, then uncover and bake 15 minutes more until golden and bubbly.