The efficiency of thin-film solar cells strongly depends on the plasmonic structures, cloaking, and especially the microscopic and nanoscopic material inhomogeneity and surface topography of the absorber. However, the understanding of the latter requires optoelectronic characterization on a nanoscale. In this study, by applying an aperture-type scanning near-field optical microscope (SNOM) in illumination mode, direct photocurrent measurements with sub-100 nm resolution were performed on randomly textured hydrogenated microcrystalline silicon (μc-Si:H) thin-film solar cell, flat μc-Si:H thin-film solar cell and flat hydrogenated amorphous silicon (a-Si:H) thin-film solar cell in order to investigate the influence of material inhomogeneity and surface topography on the local photocurrent generation. While in case of the randomly textured μc-Si:H solar cell, contrary behaviors of the photocurrent response between short and long wavelengths were identified, the same correlation between the photocurrent signal and the surface topography was observed for the two flat solar cells at all wavelengths. The measurement results can be explained by a combination of two dominant effects, (i) local light coupling into the sample and (ii) light propagation inside the sample. By this study, on the one hand the importance of surface texturing as a concept to increase the efficiency is demonstrated. On the other hand, the influence of the interaction between the SNOM probe and the surface on the photocurrent measurements has been investigated.