An answer on Academia.SE claims that
in general, any lectures, slides, textbooks, or scholarly articles you [as faculty] write belong to you and not your school, and this is true regardless of whether the school posts a policy on its web site claiming otherwise, and even regardless of whether they get you to sign a contract stating otherwise.
and cites Weinstein v. University of Illinois and Hays v. Sony Corp in support of this statement.
However, it seems to me that Weinsten v. University of Illinois explicitly considers university IP policy in making the determination of whether the scholarly work under consideration was "work for hire". First it says
The statute is general enough to make every academic article a "work for hire" and therefore vest exclusive control in universities rather than scholars. See DuBoff, An Academic's Copyright: Publish and Perish, 32 J. Copyright Society 17 (1984). The University of Illinois, like many other academic institutions, responded to the 1978 revision of the copyright laws by adopting a policy defining "work for hire" for purposes of its employees, including its professors.
then it quotes the university policy on work for hire, and then it makes a determination based on whether the university IP policy on work for hire can be interpreted to apply to the particular work under consideration:
The University's copyright policy [on work for hire] reads more naturally when applied to administrative duties. Perhaps the University forms a committee to study the appropriate use of small computers and conscripts professors as members. The committee may publish a report, in which the University will claim copyright. We do not say that a broader reading is impossible, but such a reading should be established by evidence about the deliberations underlying the policy and the course of practice
Furthermore, the more recent Bosch v. Ball-Kell refers to a
directive in Weinstein, to look for evidence of intent from the history and deliberations that occurred in implementing the University's policy.
Thus it is not clear to me whether the so-called "teacher exception" to work for hire applies if the university's intellectual property policy or contract asserts ownership of copyright of course materials.