Task Scheduler - Available Arguments

Tony 1 Reputation point
2022-10-14T09:43:51.827+00:00

I have a Powershell script running on an event with the Task Scheduler and it works well, but I would like to get some of the information from the event to pass into the Powershell script. I cannot seem to find a list of available arguments I can pass in and find it hard to believe there are none?

For example I'd like to pass in the following:

event id
event message
event date/time

Anyone have any idea how to get these passed in as additional arguments?

Windows Server Management
Windows Server Management
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Management: The act or process of organizing, handling, directing or controlling something.
442 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,576 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. MotoX80 34,761 Reputation points
    2022-10-14T12:16:21.307+00:00
    0 comments No comments

  2. Limitless Technology 44,421 Reputation points
    2022-10-19T07:28:30.72+00:00

    Hello there,

    It seems like we cannot get the list of arguments in any official Microsft Blogs. To pass on additional arguments you can check the below articles which might help in getting some insights.

    Windows Task Scheduler w/ Multiple Arguments https://learn.microsoft.com/en-us/answers/questions/564326/windows-task-scheduler-w-multiple-arguments.html

    Scheduled Task - Trigerred by Event - Getting data into the scripts as parameters https://social.technet.microsoft.com/Forums/en-US/382b9023-01a9-4131-b2f2-8560b593bc3f/scheduled-task-trigerred-by-event-getting-data-into-the-scripts-as-parameters-question?forum=winserverpowershell

    ------------------------------------------------------------------------------------------------------------------------------------------------

    --If the reply is helpful, please Upvote and Accept it as an answer–

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.