my script was built for mega large pm db, and for that i dropped the recount of pm... but it is simple... a lot...
you will have to duplicate the function build_pm_counters(), because that actual one is working only with userinfo, the actual user, not in batch process...
i did not include it because it would overhead the server... and actually, each time a member will post or receive a new pm, the count is updated... that's why i did not do it.