ansible-collections / community.windows

Windows community collection for Ansible
https://galaxy.ansible.com/community/windows
GNU General Public License v3.0
199 stars 154 forks source link

Request to add valuequeries as an additional option for the win_scheduled_task module under the type: event #351

Open ghost opened 2 years ago

ghost commented 2 years ago
SUMMARY

Would like to have the ability to add ValueQueries as an option for win_scheduled_tasks module when chosing the type: event

ISSUE TYPE
COMPONENT NAME

community.windows.win_scheduled_task

ADDITIONAL INFORMATION

As of right now when you are using type event and a subscription, you do not currently have the ability to add valuequeuries an example of an xml output of a scheduled task that uses valuequeueries

true <QueryList><Query Id="0" Path="System"><Select Path="System">*[System[Provider[@Name='Microsoft-Windows-WAS'] and EventID=5011]]</Select></Query></QueryList>** **** Event/System/Channel Event/System/EventRecordID Event/System/Level ****
    - name: Create Event Task 
      community.windows.win_scheduled_task: 
        type: event
        subscription: <QueryList><Query Id="0" Path="System"><Select Path="System">*[System[Provider[@Name='Microsoft-Windows-WAS'] and EventID=5011]]</Select></Query></QueryList><valuequeries><value
        valuequeries: 
          - name: eventChannel
            value: Event/System/Channel
          - name: eventRecordID
            value: Event/System/EventRecordID
          - name: eventSeverity
            value: Event/System/Level
        actions: 
         - path: powershell
           working_directory: "{{icis_disk_config.name}}:/script"
           arguments: .\EventTriggerScript.ps1 -eventRecordID $(eventRecordID) -eventChannel $(eventChannel)
kometkamerat commented 9 months ago

I second that! It's required to be able to make working event type tasks

Borgquite commented 4 days ago

This should be supported now using win_dsc and the latest version of ComputerManagementDsc