I'm trying to create an Item that will pull in the number of minutes a process is running, then i can create a trigger if it is running over 8min. The command I use below works if i just paste the powershell part on the system, but when i run it from Zabbix, i get the error just below the command.
system.run[powershell.exe -NoLogo "((New-TimeSpan -Start (Get-Process -Name cmd).StartTime)).TotalMinutes"]
New-TimeSpan : Cannot convert 'System.Object[]' to the type 'System.DateTime' required by parameter 'Start'. Specified
method is not supported.
At line:1 char:23
+ ((New-TimeSpan -Start (Get-Process -Name cmd).StartTime)).TotalMinute ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (
[New-TimeSpan], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Microsoft.PowerShell.Command s.NewTimeSpanCommand
Any thoughts?
system.run[powershell.exe -NoLogo "((New-TimeSpan -Start (Get-Process -Name cmd).StartTime)).TotalMinutes"]
New-TimeSpan : Cannot convert 'System.Object[]' to the type 'System.DateTime' required by parameter 'Start'. Specified
method is not supported.
At line:1 char:23
+ ((New-TimeSpan -Start (Get-Process -Name cmd).StartTime)).TotalMinute ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (
[New-TimeSpan], ParameterBindingException+ FullyQualifiedErrorId : CannotConvertArgument,Microsoft.PowerShell.Command s.NewTimeSpanCommand
Any thoughts?
Comment