Report on next effective maintenance window

Hi all
I'm having a problem with this custom function/report posted on TechNet while back for ConfigMgr 2007
I've made the needed changes according to this blog post:
..but when using maintenance windows that occurs for example 1st tuesday of every 1 months, the function returns the date week ahead. For example now (on 26th of Feb) next maintenance window should be on Tuesday March 3rd, but instead the report is showing
Tuesday March 10th.
Any help on modifying the function would be appreciated, I saw that there comments on the original post about the recurrence type 4 (monthly by weekday as noted here not working correctly in the function.
Ideal solution for me would be that the clients report their next maintenance windows through hardware inventory, but I don't think that's possible.
Thanks in advance for any suggestions!


I recommend you post this question in SQL forum as modifying the function is very complicated.
Best Regards,
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]