Register-ScheduledJob with Parameters

Welcome Forums General PowerShell Q&A Register-ScheduledJob with Parameters

This topic contains 1 reply, has 2 voices, and was last updated by

 
Participant
5 years, 2 months ago.

  • Author
    Posts
  • #13171

    Participant
    Points: 0
    Rank: Member

    I have been using the following:-
    Register-ScheduledJob -Name $jobName -FilePath $filePath -Trigger $trigger -ScheduledJobOption $joboption -credential $cred

    And now I need to do similar but the script I reference in $filepath now requires 2 parameters, do I need to use a Script blocl to pass the parameters in or is there another way? – Would it be possible to see an example of how to get this working with 2 parameters?

    Thanks
    Gregor

  • #13182

    Participant
    Points: 0
    Rank: Member

    I think that's what the -ArgumentList parameter is for:

    Parameters
    -ArgumentList Specifies values for the parameters of the script that is specified by the FilePath parameter or for the command that is specified by the ScriptBlock parameter.

    Required? false
    Position? named
    Default value None
    Accept pipeline input? false
    Accept wildcard characters? false

The topic ‘Register-ScheduledJob with Parameters’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort