I have written a Powershell script with a defined function. It runs just fine when executed in a powershell window, but when PRTG runs it, it says the command (the function I defined later in the script) is not recognized. Is there some restriction on how functions work in Powershell when used by PRTG?
Here is the beginning of my code: (Get-ScheduledTask is a function I defined right after this code)
Param( [string]$MyComputerName, [string]$MytaskName ) $task = ((Get-ScheduledTask -ComputerName $MyComputerName) | select TaskName, LastRunTime | Where-Object {$_.TaskName -eq $MytaskName}) write-host (New-Timespan -Start $task.LastRunTime).Minutes,":OK"
Add comment