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.


  • 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):
-executionpolicy bypass -command "& {. C:\Scripts\MyFunctions.ps1; Get-MyFiles -Path D:\Data\Files\ -TranscriptPath C:\Scripts\ -Verbose}"


Leave a Reply

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