Just for the record, I had to change part of the query to make this work in OCS 2007 R2.
The rtcdyn.dbo.HomedUserDynamic should be changed to rtcdyn.dbo.HomedResourceDynamic.
This is a really straightforward fix, but I thought I'd throw it out here so people wouldn't have to look for it.