Preheat oven to 350°F. Grease a 13"x9" baking dish.
Heat 1 tablespoon of the butter in a medium skillet on medium-high heat. Once hot, add diced ham and onion. Cook until the onion is translucent and ham is starts to brown. Remove from the skillet to a bowl, and set aside.
In the same skillet, turn the heat to medium, and melt the remaining butter. Whisk in flour and cook 1-2 minutes, until the mixture is bubbly and lightly golden brown.
Add the milk, continuing to whisk periodically until the mixture thickens, about 3-5 minutes. Stir in garlic powder, onion powder, salt, and pepper.
Add 2 cups of the shredded sharp cheddar cheese, and stir until the cheese is completely melted and the sauce is smooth. Remove from heat.
In a large bowl, combine the frozen diced potatoes, cooked ham and onions, and cheese sauce. Stir until everything is well coated. Season with additional salt and pepper if desired.
Transfer the mixture to the prepared baking dish and spread out evenly.
Sprinkle the remaining shredded sharp cheddar cheese and mozzarella cheese evenly over the top.
Bake 45-50 minutes, or until the casserole is bubbly and the top is golden brown. Remove from the oven and let it sit for a few minutes. Garnish with chopped parsley or sliced green onions, if desired.