This is the approach documented by Microsoft to address this.
Note:
You must use the setting options provided in the drop down boxes, even though the GUI appears to be freeform fields, they are not.
See:
Configuring Advanced Scheduled Task Parameters Using PowerShell
The Missing Parameters
Great, so now we have a script, a scheduled task that runs the script, and it will run every time the server or workstation is started up. But we have failed to meet one of the requirements; the task must also repeat every 10 minutes for 1 day. If you go back and attempt to add a repetition interval or repetition duration you will notice that neither are an option for the -AtStartup parameter:
Through the GUI the scheduled task parameters are available:
But they are not available via the PowerShell New-ScheduledTaskTrigger cmdlet if you choose the -AtStartup parameter. They are available via the -Once parameter but that would not meet the requirements. The solution is to directly modify the task's properties using its XML schema. This may sound complicated at first but in reality it is very easy and will allow you to modify practically every parameter of the scheduled task.
Step 1 - Get the scheduled task. The first step is to get the scheduled task that you just created and store it in an object.
$Task = Get-ScheduledTask -TaskName "SampleScheduledTask"
Step 2 - Update the specific property of the task that you wish to modify. For this example we wish to add a repetition duration and a repetition interval.
$Task.Triggers.Repetition.Duration = "P1D"
$Task.Triggers.Repetition.Interval = "PT10M"
You are probably wondering how I knew P1D would equal a duration of 1 Day and how I knew PT10M would equal a repetition interval of 10 minutes since neither are the typical date/time or timespan values that you are probably used to working with. To get those values I simply configured the duration and interval that I wanted through the GUI then viewed the result through Powershell using the following command:
$Task.Triggers.Repetition | fl *
Step 3 - Save the new configuration to the scheduled task. Remember, you must re-enter the credentials for the task here or the operation will fail.
$Task | Set-ScheduledTask -User "NT AUTHORITY\SYSTEM"
What version of PowerShell? Have you looked into importing a scheduled task .xml file that already has the scheduled determined? – music2myear – 2018-11-06T22:16:47.213