Planar microstrip photonic bandgap (PBG) structures are periodic arrays of holes etched in the ground plane of a conventional microstrip line. Most of the published studies considered the PBG as an unshielded structure. However, to fabricate a circuit with a PBG structure, a metallic enclosure is often needed. Thus, the S-parameters of the PBG structure will be altered correspondingly. In this paper, the influence of the metallic enclosure on a shielded PBG structure as well as the finite ground plane on an unshielded PBG structure on the S-parameters are analyzed using the finite-difference time-domain (FDTD) method. Conditions for which the influence can be neglected are obtained. The results are useful for the applications of PBG structures.