How to schedule Powershell function with parameters

Tip how to schedule with Tasks Scheduler Powershell script which contains function we need to run and parameters.

Scenario:

  • We have Powershell script called MyFunctions.ps1 saved in┬áC:\Scripts
  • We want to run function called Get-MyFiles
  • We have 2 mandatory parameters: Path, TranscriptPath
  • We use 1 global parameter: Verbose

Our scheduled task will contain in tab Actions following action:

  • Action: Start a program
  • Program/script:

  • Add arguments (optional):

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.