We investigate the potential energy surfaces (PESs) of the hydrogen-based cation H2+ and the neutral molecule H2 confined inside an infinite potential well in the shape of a regular icosahedron. The numerical computations are performed using the diffusion Monte Carlo method and are based on an analytical technique for obtaining simple equations of the surfaces of convex polyhedra proposed by S. Onaka. Different states and different orientations of the molecules inside the confining potential well, as well as various sizes of the latter, are studied. We provide a detailed symmetry analysis and consistent labeling of the H2+ states considered. The results show that the icosahedral confinement is closely isotropic in its inner region, leading to PESs that develop pronounced minima, as in the case of simpler confinement geometries. Shape-specific effects can be evidenced when the nuclei are in contact with the confining wall.