Pulling Policy Schedules From API

I am looking at building out some automation in presenting patching schedules and alerting the team that an upcoming patching window is approaching.

In the API I know I get get a policies settings and when I look at what is presented, it isn’t something easily understandable.

  "schedule_days": 64,
  "schedule_weeks_of_month": 4,
  "schedule_months": 8190,
  "schedule_time": "02:00",

That info somehow translates to every month, on the 2nd Saturday at 2AM. Is there a way of understanding/translating this to be able to actually read the policy schedule?

In doing some digging I found the following.

  • Monday = 2
  • Tuesday = 4
  • Wednesday = 8
  • Thursday = 16
  • Friday = 32
  • Saturday = 64
  • Sunday = 128

So I am guessing schedule_weeks_of_month work the same way. Week 1 is 2, Week 2 is 4 and so on. Figuring out the math on how to tell if say Monday and Friday are picked will take some doing.

Hey Joe, you’re on the right track here. There’s some more explanation on how it works here


It is essentially a binary representation of the day of week, or week of month, or month of year converted to decimal.


Thanks that makes it so much easier. I was looking at the policy part in the API doc, didn’t think to look at creating a new policy to get the info.

1 Like