Wednesday, 18 October 2017

Get-ScheduledTask does not return monthly, or monthly day of week triggers.

So having worked with the Task Scheduler Library in Windows over the last few weeks it's a real problem area of Windows

I've already mentioned the issue that deprecated features still appear in the user interface.

The next area to note is that the Get-ScheduledTask PowerShell cmdlet is not fully functional. If you create a scheduled task with a monthly trigger (or a monthly day of week trigger) this cannot be read using the cmdlet.

Instead of a fully fledged object like you would receive from the other trigger types you instead receive the base object.

MSFT_TaskTrigger

Enabled               : True
EndBoundary           :
ExecutionTimeLimit    :
Id                    :
Repetition            : MSFT_TaskRepetitionPattern
StartBoundary         : 2017-10-18T19:31:14
PSComputerName        :
CimClass              : Root/Microsoft/Windows/TaskScheduler:MSFT_TaskTrigger
CimInstanceProperties : {Enabled, EndBoundary, ExecutionTimeLimit, Id...}
CimSystemProperties   : Microsoft.Management.Infrastructure.CimSystemProperties

I was hoping that the limitation was with the PowerShell cmdlets however on checking it seems that the limitation is with the underlying WMI in the ROOT\Microsoft\Windows\TaskScheduler namespace.

The only option in this case is to parse the XML configuration files directly. Not pleasant.

No comments:

Post a Comment