If the PowerShell script does not run, it may be due to several factors.
- Check the execution and path of the script in the module. Remember that the execution has to be similar to the following module:
module_begin module_name Powershell_Script module_type generic_data_string module_exec powershell.exe -File "%ProgramFiles%\pandora_agent\util\Powershell_script.ps" module_end
- In case the previous point is correct, launch the script directly in PowerShell to see if the script itself is well formed and see what output it gets.
If we get any errors in the execution, we will have to correct the behavior of the script, otherwise we will have to check the permissions of the script and the actions it performs, for example:
– If you make a query to a server using a user, that user must have permissions to perform the query.
– The computer that launches the script must have connectivity with the server to which it is launching the query.
– If there is a domain name in the script, make the call to the IP in case there is a problem with the DNS server.
If no previous problem has been detected, we will have to put the agent in debug mode to analyse the execution it is launching. (We recommend the use of the generic_data_string
module type in case the module returns an output that does not correspond with its original type).
When we put the agent in debug mode, a pandora_debug.log
file will be created in the agent directory where all the executions performed by the agent will be written, so we could obtain the execution of the script.