In this paper, we report on the influence of a square (triangular) trench on the superconducting properties of a perforated mesoscopic sample. Effects associated to the pinning force of the hole versus the pinning by the trench and interplay between the shape of the outer boundary and the shape of the inner defects on the vortex configuration are studied for a thin disk. Using the Ginzburg–Landau theory, we calculate the magnetization, vorticity, free energy, magnetic induction, supercurrent and superconducting order parameter as a function of the applied perpendicular magnetic field. We show that only in a restricted range of the magnetic field the vortex configuration obeys the geometry of the trench. Nevertheless, we clearly demonstrate that in our sample new phenomena are possible due to competing interactions of the geometry of the sample and the added geometry of the nanoengineered trench.