Script and Wazuh AgentThis guide describes how to collect a machine inventory from AD using PowerShell.How to Run a PowerShell Script from Task Scheduler?Requirements:
Task Scheduler is a built-in utility in Windows that allows you to create and manageautomated tasks. These tasks can be triggered based on various criteria, such as a specifictime, system startup, or even a particular event.
PowerShell is really a game-changer to automate repetitive or time-consuming processes,Combining the flexibility of PowerShell with the scheduling capabilities of Task Scheduleropens up a world of possibilities for automating repetitive tasks and running maintenancescripts. You can automate PowerShell scripts with the Windows task scheduler.To schedule a SharePoint PowerShell script to run in Task Scheduler, ensure you have thenecessary PowerShell modules, such as “Microsoft.SharePoint.PowerShell” orPnP.PowerShell is installed on the machine first. Then proceed with the below steps tocreate a scheduled task for the SharePoint PowerShell script:
Important: You must specify a value for the Start-in field, even though it's optional. This is because if no value is specified, PowerShell exports the output in the“C:\Windows\System32” directory.
Select the checkbox “Open the Properties dialog for this task when I click Finish”, and click the Finish button.
In the properties dialog, under the General tab, ensure that the “Run when user is logged on or not” and “Run with highest privileges” checkboxes are selected to ensure you are running the script with Administrative rights
Click the “OK” button to get a login prompt. Confirm the User Name and password in which the task runs (preferably a service account with a password never expires flag set) and press enter. The task scheduler will create a new task to run the PowerShell script on given parameters.
The output of the inventory will be formatted yo JSON and appended to the active responses log file in the agent.The Wazuh manager already has detection rules to classify these events.Grafana, under the EDR Dashboards section, “EDR – AD INVENTORY”, will display the inventory collected.
Was this article helpfu?
Thank you for voting
You are related to multiple companies. Please select the company you wish to login as.