The development of nanoscience makes the understanding of the electrical properties of nano-objects essential. The Kelvin Force Microscopy (KFM) is one of the most useful techniques to map at the nanoscale and simultaneously both the topography and contact potential difference (CPD). After 20 years of development, KFM is mainly operated under air at normal pressure, allowing to perform, in an easy way, multiple comparative analyses. However, under UHV, as the surface is controlled and the sensitivity improved, more accurate and reliable measurements can be achieved. In the first part, KFM under ambient atmosphere is improved by developing the single-scan method using either a frequency modulation (FM) or an amplitude modulation (AM) mode. An external Nanonis electronic has been implemented on commercial AFMs (Dimension 3100 and MultiMode, Bruker). A comparative study with the common Lift-mode is done by imaging epitaxial graphene layers on SiC sample. The tip-sample separation effect on the CPD contrast and resolution is described as well as experimental settings. It is shown that higher contrasts are obtained using single-scan frequency modulation KFM regardless the tip-sample operating distance. In a second part, the KFM technique under secondary vacuum is developed. The instrumental work is carried out with an EnviroScope AFM from Bruker. We outfitted our Veeco's AFMs with an external Nanonis electronic to perform simultaneously the acquisition of topography and CPD using either the amplitude or the frequency modulation mode. The upgrade of the electronic has raised compatibility issues. Our results show that the comparable results are obtained with KFM under UHV. Finally, having laid down both the experimental and theoretical groundwork of the KFM, this technique is used to characterize CdTe/CdS heterostructures used in thin films solar cell application. A protocol for the cross section sample preparation has been specifically developed. The CdTe/CdS heterojunction is studied under polarization both in dark and under illumination. The influence of the CdS layer thickness is also studied to understand its dramatic effect on the solar cell efficiency.