...
Code Block | ||
---|---|---|
| ||
# add an arbitrary event $event = Add-JobSchedulerEvent -EventClass daily_closing -EventId 12345678 # wait for the event service to process the request Start-Sleep -Seconds 3 # check the list of events $events = Get-JobSchedulerEvent $events # remove the newly created event $event | Remove-JobSchedulerEvent # think twice before removing all events Get-JobSchedulerEvent | Remove-JobSchedulerEvent |
Explantions
- The
Add-JobSchedulerEvent
cmdlet returns an event object that can be used for later pipelining - Event processing occurs asynchroneously, therefore newly created events might take some seconds to be available for retrieval..
- The
Get-JobSchedulerEvent
cmdlet retrieves an array of event objects that are available with JobScheduler. - A previously created event object can be pipelined to the
Remove-JobSchedulerEvent
cmdlet. - In a more general sense all events as returned from
Get-JobSchedulerEvent
can be pipelined to theRemove-JobSchedulerEvent
cmdlet.
...