PSCCMClient icon indicating copy to clipboard operation
PSCCMClient copied to clipboard

Add support for RecurType 6 (SMS_ST_RecurMonthlyByWeekdayBase) in ConvertFrom-CCMSchedule

Open Copilot opened this issue 4 months ago • 0 comments

The ConvertFrom-CCMSchedule function was failing when encountering schedule strings with RecurType 6, throwing the error "Parsing Schedule String resulted in invalid type of 6".

This issue was caused by Microsoft recently adding a new schedule type SMS_ST_RecurMonthlyByWeekdayBase (type 6) that includes a "Days Offset" parameter for monthly recurring schedules by weekday. The function only supported types 1-5 and didn't recognize this new type.

Changes Made:

  • Added type 6 mapping to the TypeMap: 6 = 'SMS_ST_RecurMonthlyByWeekdayBase'
  • Implemented case 6 in the switch statement to parse the new schedule type fields:
    • Day (3 bits at position 13-15)
    • ForNumberOfMonths (4 bits at position 16-19)
    • WeekOrder (3 bits at position 20-22)
    • OffsetDay (3 bits at position 23-25) - new field specific to this type
  • Added descriptive text that includes the offset information

Example:

# Previously this would fail with "invalid type of 6" error
ConvertFrom-CCMSchedule -ScheduleString '005C7D4020331680'

# Now returns:
# SmsProviderObjectPath : SMS_ST_RecurMonthlyByWeekdayBase
# Day                   : 3
# ForNumberOfMonths     : 1
# WeekOrder             : 3
# OffsetDay             : 2
# Description           : Occurs the 3rd Tuesday of every 1 months with 2 day offset effective 07/28/2023 02:00:00

The output matches Microsoft's Convert-CMSchedule cmdlet exactly, and all existing functionality remains unchanged.

Fixes #57.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot avatar Aug 28 '25 13:08 Copilot