Adjust oven rack to middle position and heat oven to 350°.
Melt butter in a large Dutch oven over medium-high heat.
Add onions and cook until softened and lightly browned, about 5-7 minutes.
Add potatoes, half-and-half, salt and black pepper and bring to a simmer.
Cover and adjust heat to maintain a light simmer and cook until potatoes are almost tender, about 15 minutes.
Transfer potato mixture and ham to a 3-quart gratin dish and sprinkle with cheese.
Bake until half-and-half has thickened and is bubbling around sides and top is golden brown.
Cool for 5 minutes before serving.
