Currently, it is possible to lauch powershell scripts using the User Parameter feature of a Windows agent. However, this works in a limited fashion since some parameters cannot be correctly passed through ??%systemroot%\system32\windowspowershell\v1.0\powershell.exe. For example, if we launch a script which requires a * somewhere in the parameters, it generates an error.
For example the user parameter would be:
UserParameter=oracle.10g.query[*],%systemroot%\system32\windowspowershell\v1.0\powershell.exe -nologo C:\Zabbix\Scripts\Zabbix_Oracle10gQuery.ps1 -TNS $1 -User $2 -Password $3 -IntegratedSecurity $4 -Query $5
The query parameter would be "SELECT COUNT FROM someTable". Although the script works fine directly called in a PS environment. It breaks when called through the CMD.EXE environment.
If we could have, say a User Parameter that uses the cmd.exe like we have now, AND a PSUser Parameter that directly invokes PS commands. This would be alot more powerful and would be much more geared towards the futur Windows environments.
Thank you alot for you time and all your efforts.
- depends on
-
ZBXNEXT-7021 Add new key for PowerShell commands system.run.ps
- Spec. sign-off