Understanding the vertical compositional homogeneity and defect distribution is of paramount importance in elucidating and maximizing the performance of halide-perovskite-based optoelectronic devices. This work reports the depth-dependent study of the chemical composition and metallic Pb0 content of all-inorganic CsPbIBr2 perovskite films undertaken using lab-based hard X-ray photoelectron spectroscopy and soft X-ray photoelectron spectroscopy. The presence of elemental or metallic Pb (Pb0), in the bulk and at the surface of the perovskite films highlights the formation of defect or recombination centers throughout the analyzed depth. The Pb0 content was found to be of higher concentration in the bulk of the CsPbIBr2 films compared to that at the surface. Engineering the CsPbIBr2 film growth using appropriate antisolvents resulted in the overall reduction and/or complete elimination of Pb0 at the surface and at the bulk of the perovskite films. However, the effect of antisolvent treatment was significantly pronounced in the bulk-like region as compared to that at the surface. Pb0 is synonymous with defect states/recombination centers in perovskite films and this reduction in defect density due to the antisolvent treatment corroborates the enhanced phase stability and improved solar cell performance of the corresponding CsPbIBr2 devices.