Have a powershell script that will create a scheduled task, for deployment, by way of Octopus, to a Windows 2012 server.
Function Create-ScheduledTask($TaskN
I have similar task and most elegant solution that I found was to create the schedule task at test environment /local PC using the GUI and export it as XML. Then copy the XML formatted text and embedded it into the script, after execution the script save this string block as XML file locally and run schtasks.exe to create the new task.
schtasks.exe /create /RU "NT AUTHORITY\SYSTEM" /TN TaskName /XML "XMLFolder\TaskName.xml"