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 Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

%d bloggers like this: