We report the effect of geometrical factors governing the polarization profiles of near-field scanning optical microscope (NSOM) probes. The most important physical parameter controlling the selective electric or magnetic field sensitivity is found to be the width of the metal rim surrounding aperture. Probes with metal rim width w < lambda/2 selectively senses the optical electric field, while those with w > lambda/2 selectively senses the optical magnetic field. Intensity variation of optical Hertz standing wave formed upon reflection at oblique incidence shows a phase difference of pi/2 between electric and magnetic probes: an analogue of the classical Wiener's experiment. Our work paves way towards electromagnetic engineering of nanostructures.