if I run "Write-Host $ScheduleAdd" after it in the script, it will successfully write to the console the exact command that can be copied and pasted into command prompt and run to create the scheduled task.
So I'm trying to figure out, why is it not actually adding the task to task scheduler when I set the variable above?
I can copy/paste it into the prompt and run it, and it adds, but if I don't copy paste the command, it will not add?
So Write-Host $ScheduleAdd will print out just like this:
It will print that out, but Powershell isn't executing it. I have to copy and paste it into the powershell window, and then it executes it, adding it to the scheduled tasks.