Starting a scheduled task using Powershell

Hi all,

I am trying to run a scheduled task that runs a powershell script as administrator to start a service.

I am trying to start that scheduled task using powerhshell, using Start-ScheduledTask, but I am getting an error saying that this is not recognised as a cmdlet. Am I missing something here?

"Start-ScheduledTask -TaskPath '\MyApps\' -TaskName 'PowerfulPowerShell'"

Invoke Power Shell: The term ‘Start-ScheduledTask’ is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

@TJ_automates

To resolve this issue, you need to import the “ScheduledTasks” module before using the Start-ScheduledTask cmdlet. Here’s how you can do it:

Import the ScheduledTasks module

Import-Module ScheduledTasks

Start the scheduled task

Start-ScheduledTask -TaskPath '\MyApps' -TaskName ‘PowerfulPowerShell’

Thanks, but this still gives me the same error.

I have solved it however, which I’ll put in a seperatereply

So the solution is roundabout - You have to start powershell to call powershell with the args to start the task (which also calls powershell…)

The code is:
"Start-Process 'Powershell' -args 'Start-ScheduledTask -TaskPath ""\MyApps"" -TaskName ""PowerfulPowerShell""'"

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.