Schtasks vs. NewScheduledTask

Hi all
I’m working on a script that will create/delete scheduled tasks according to its input arguments.
I came accross two possibilities and I’d like to hear the pro’s and con’s about it.
So there is “schtasks” and the PS command “NewScheduledTask”.
While I started writing the script with “schtasks” my colleague complained that “this is not the right way” … but also couldn’t answer my question: “why” ?

There is no “right way”. Whatever meets your requirements is fine. If you can accomplish what you need with schtasks go with it.

1 Like