Hi there,
I'm trying to add a windows schedule task sensor (target device is Windows 2012 R2) but I can't see any of the scheduled tasks jobs listed on prtg sensor. I have got: "No Task Name available".
Thanks
Article Comments
Hi there,
All the requirements have been met but still having issues. The only thing we do not have installed in our probe is .NET 3.5. Would it make a difference?
Thanks
Jul, 2015 - Permalink
Hello federicogomez,
You can try to run the script manually and check the results:
Within the command line prompt in the PRTG Probe/Server navigate to C:\Program Files (x86)\PRTG Network Monitor\Sensor System, from there, run the following:
ScheduledTaskXML.exe -c=monitoreddevice.domain -l -u=domain\user-p=password
Please update the monitoreddevice.domain, domain\user and password to your actual environment.
If the script succeeds, try running the PRTG Service under a different account or check the account provided within PRTG on the CREDENTIALS FOR WINDOWS SYSTEMS on the device where you're trying to add the sensor.
Jul, 2015 - Permalink
Hi,
I have run the script as the PRTG service account (who is a member of the domain admins group) and got the following message:
The following feature couldn't be installed: .NET Framework 3.5 (includes .NET 2.0 and 3.0)
Cheers,
Jul, 2015 - Permalink
Hello,
In that case please additionally install .NET 3.5 on the PRTG Probe Server that will hold the created sensor.
Best Regards,
Jul, 2015 - Permalink
After installing .Net 3.5 in the local site probe it worked OK.
Thanks a lot for you help.
Regards
Jul, 2015 - Permalink
Hello,
I wrote an alternative PowerShell Script:
http://mycloudrevolution.com/2016/09/15/prtg-advanced-scheduled-task-sensor/
Sep, 2016 - Permalink
Thanks a lot Markus for the contribution! Can I ask you for one thing? Correcting the type in the first part of your article Peassler should be Paessler
Sep, 2016 - Permalink
Hello
Unfortunately when I needed your script, I didn't find it Markus, I wrote mine which is simpler than yours. It targets a specific scheduled task. In case it would be helpful here it is
param( [string]$computerName, [string]$scheduledTaskName, [string]$scheduledTaskPath ) $session = New-PSSession -computerName $computerName -Authentication Kerberos $scriptBlock = { param( $scheduledTaskName, $scheduledTaskPath ) $taskStatus = Get-ScheduledTask -TaskName $scheduledTaskName | select -ExpandProperty state $taskExecution = Get-ScheduledTaskInfo -TaskName "$scheduledTaskPath\$scheduledTaskName" | select LastRunTime, NextRunTime, LastTaskResult $date = date switch ($taskStatus){ "Ready" {$taskStatus = 1} "Disabled" {$taskStatus = 2} "Running" {$taskStatus = 3} } $LastRunTime = $date - $taskExecution.LastRunTime $LastRunTime = $LastRunTime.hours $NextRunTime = $taskExecution.NextRunTime - $date $NextRunTime = $NextRunTime.hours $result= "<?xml version=`"1.0`" encoding=`"Windows-1252`" ?>`r`n" $result+="<prtg>`r`n" $result+=" <result>`r`n" $result+=" <channel>State</channel>`r`n" $result+=" <Unit>custom</Unit>`r`n" $result+=" <CustomUnit>(1=Ready; 2=Disabled; 3=Running)</CustomUnit>`r`n" $result+=" <value>$taskStatus</value>`r`n" $result+=" </result>`r`n" $result+=" <result>`r`n" $result+=" <channel>LastRunTime</channel>`r`n" $result+=" <Unit>TimeHours</Unit>`r`n" $result+=" <value>$LastRunTime</value>`r`n" $result+=" </result>`r`n" $result+=" <result>`r`n" $result+=" <channel>NextRunTime</channel>`r`n" $result+=" <Unit>TimeHours</Unit>`r`n" $result+=" <value>$NextRunTime</value>`r`n" $result+=" </result>`r`n" $result+=" <result>`r`n" $result+=" <channel>LastTaskResult</channel>`r`n" $result+=" <Unit>custom</Unit>`r`n" $result+=" <CustomUnit>(0=Okay)</CustomUnit>`r`n" $result+=" <value>$($taskExecution.LastTaskResult)</value>`r`n" $result+=" </result>`r`n" $result+=" <text>OK</text>`r`n" $result+="</prtg>`r`n" $result } Invoke-Command -computerName $computername -scriptBlock $scriptBlock -ArgumentList $scheduledTaskName, $scheduledTaskPath Remove-PSSession -computerName $computername Exit 0
Jan, 2018 - Permalink
Please check the Remarks of the Windows Scheduled Task Sensor.
Also note the following requirements:
After going through the remarks and requirements, try creating the sensor anew.
Important note: The Windows Scheduled Task sensor is deprecated as of PRTG version 16.1.23.
Please see the following article for more details and possible alternatives:
Jul, 2015 - Permalink