Cook the pasta as usual. Mix the cream cheese with the egg and cream, season with salt and pepper to taste. Dice the ham and mix with the pasta. Put this in a greased casserole dish, pour the cream and cheese mixture over it, also the butter in pieces. Bake in the preheated oven for about 30 minutes at medium heat.