The invention relates to a method of preparing a composition comprising (a) reacting a binder component (B) comprising at least one alkoxysilane (B2), and a polymer dispersion (PD), thus obtaining a prepolymer and subsequently (b) mixing or hydrolyzing and polycondensing said prepolymer in the presence of water and at least one antimicrobial agent (Z) comprising at least one antimicrobial active (Z1) and optionally a particulate carrier substance (Z2), wherein the at least one antimicrobial agent (Z) is unreactive during step (b).