Molecular dynamics simulation barostat schemes are derived for achieving a given normal pressure for a thin liquid or solid layer confined between two parallel walls. This work builds on the boundary-controlled barostat scheme of Lupkowski and van Swol [J. Chem. Phys. 93, 737 (1990)]. Two classes of barostat are explored, one in which the external load is applied to a virtual regular lattice to which the wall atoms are bound using a tethering potential. The other type of barostat applies the external force directly to the wall atoms, which are not tethered. The extent to which the wall separation distribution is Gaussian is shown to be an effective measure of the quality of the barostat. The first class of barostat can suffer from anomalous dynamical signatures, even resonances, which are sensitive to the effective mass of the virtual lattice, whose value lacks any rigorous definition. The second type of barostat performs much better under equilibrium and wall-sliding nonequilibrium conditions and in not being so prone to resonance instabilities in the wall separation and does not require so many largely arbitrary parameters. The results of exploratory simulations which characterize the dynamical response of the model systems for both dry and wet or lubricated systems using the different barostats are presented. The barostats which have an inherent damping mechanism, such as the ones analogous to a damped harmonic oscillator, reduce the occurrence of large fluctuations and resonances in the separation between the two walls, and they also achieve a new target pressure more quickly. Near a nonequilibrium phase boundary the attributes of the barostat can have a marked influence on the observed behavior.