And thanks to Ben for the tip about permissions.
In my environments we just blanket grant sa privileges for running the maintenance scripts like this and syspolicy_purge_history so it slipped by my attention.
I also quit worrying about setting the retention window once I moved to my script because I could just pass it in, and well it was just easier to pass it in.