Starting with an adjoint pair of operators, under suitable abstract versions of standard PDE hypotheses, we consider the Weyl M-function of extensions of the operators. The extensions are determined by abstract boundary conditions and we establish results on the relationship between the M-function as an analytic function of a spectral parameter and the spectrum of the extension. We also give an example where the M-function does not contain the whole spectral information of the resolvent, and show that the results can be applied to elliptic PDEs where the M-function corresponds to the Dirichlet to Neumann map