The microdomain orientation in thin films of cylinder- and lamella-forming diblock copolymers, polystyrene-block-poly(methyl methacrylate) (PS-b-PMMA), was investigated as a function of the film thickness and the composition of random copolymers composed of styrene (S) and methyl methacrylate (MMA), denoted as P(S-r-MMA), that were anchored to the substrate. Using scanning force microscopy (SFM) and grazing incidence small-angle X-ray scattering (GISAXS), the dependence of the microdomain orientation on film thickness around lattice period (or d-spacing, L0), where the microdomain orientations normal to the film surface could be achieved, showed that the optimal condition for the balanced interfacial interactions (the so-called neutrality in random copolymer) was 0.64 of PS mole fraction (XPS) for the cylindrical microdomain having narrow compositional range of P(S-r-MMA) from 0.52 to 0.72 of XPS, whereas for the lamella microdomain it was observed at XPS = 0.55 ranging extensively from 0.48 to 0.78.