I am trying to schedule another powershell script using schtasks.exe
using following command:
$Command = cmd /c "$Env:WinDir/system32/schtasks.exe /create /s $ComputerName /tn $TaskName /tr $TaskRun /sc $Schedule /d $Days /st $StartTime /RU system"
Invoke-Expression $Command
It schedules the task on remote servers but throws an error:
"The term 'SUCCESS:' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
It does successfully schedule the job at correct times but throws this error.
Does anyone know how to resolve this error?