Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Aug 28, 2025

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 Copilot AI changed the title [WIP] ConvertFrom-CCMSchedule : Parsing Schedule String resulted in invalid type of 6 Add support for RecurType 6 (SMS_ST_RecurMonthlyByWeekdayBase) in ConvertFrom-CCMSchedule Aug 28, 2025
@Copilot Copilot AI requested a review from CodyMathis123 August 28, 2025 13:55
Copilot finished work on behalf of CodyMathis123 August 28, 2025 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ConvertFrom-CCMSchedule : Parsing Schedule String resulted in invalid type of 6
2 participants