Preheat the oven to 400 degrees and grease a 9x13 baking dish with nonstick cooking spray.
Heat the butter in a small saucepan over medium heat.
When the butter is melted, add the onion and sauté until tender, around 5 minutes.
Add the flour and stir to mix. Continue simmering until the flour begins to brown.
Add the chicken broth and milk and whisk to mix. Continue whisking while the sauce simmer.
Cook until the sauce has thickened, around 10 minutes. Season with salt and pepper to taste.
Then stir in 1½ cups of sharp cheddar cheese.
Arrange half the potatoes in the prepared baking dish and top with half the ham. Add another layer of potatoes, then ham.
Pour the cheese sauce over the top of the casserole.
Cover the pan with foil and place in the oven to bake for 45 minutes, then remove the foil and top with the remaining 1 cup of cheese.
Return to the oven to bake for another 10 to 15 minutes, until the sauce is bubbly and the cheese on top is melted.