Powershell is just a CLI to do work on the system. You can do just about anything with PS including reading/writing files, updating registry, making HTTP calls and whatnot. It is equivalent to writing the program code yourself or using CMD, it's just more flexible.
PS does support working with scheduled tasks. There is an entire cmdlet available for it as discussed here. Through that cmdlet you can interact with TS and do things like get the tasks, run tasks, created or edit tasks, etc. Behind the scenes the cmdlet is just calling the scheduled task API that the UI also uses.
- If you run
Get-ScheduledTask
then it'll return the same list of tasks as you see in the UI. If you add or change tasks via PS then the UI will show the updates as well. PS is simply calling the task API like the UI. - You can use PS to create or update tasks but if you cannot get it to work in the UI then using PS isn't going to solve your problem. The issue is most likely with your scheduled task and not how you're creating it.
Without further information it would be hard to say but some common issues I see is trying to specify a path without wrapping it in quotes. So, for example, if you need to pass a path to a command then doing something like /arg somepath
in the arguments field might work when it doesn't have spaces but fails when it does. Wrap the path in quotes. /arg "some path"
.
Another issue I have seen is that the working directory for the command is not set. You should always set the working directory of the command you're trying to run to the directory where you expect it to run from. Task Scheduler runs as a service so the default is the system directory. This tends to mess up relative path-based code.