# Unable to run NetScan using task scheduler

Started by Tom Ryans

 Tom Ryans Unable to run NetScan using task scheduler   14 June 2014, 01:58
I am trying to setup netscan to run once a week using the windows task scheduler in windows server 2008 r2 x64. I created a batch file that works fine when run manually but when it is run in the task scheduler netscan never finishes. If I login and run the task from the task scheduler manually it runs fine and I have no issues, the problem only occurs when the task is launched automatically. I also tried a powershell script to launch netscan and that works fine but I have the exact same issue - it just won't work unattended.

I can verify that the task started since netscan.exe appears in the task manager but after days of waiting it never finishes. Since the task scheduler uses a lower priority than applications run manually, I tried changing the task to run with a higher priority but that did not fix the issue either. I have no clue what the problem is since it runs perfect every time I run the batch file/powershell script manually. What could be causing this issue?

I would greatly appreciate any help!
 Re: Unable to run netscan using task scheduler   14 June 2014, 14:13 Admin Registered: 12 years ago Posts: 5 590
What's the exact command line you have scheduled to run?

Most likely if you have not supplied a configuration file, it will start with a default configuration and hang at the message box

Since there is no desktop, it might hang there indefinitely. I guess we'll need to a check in the code whether an interactive desktop is available.
 Casey Rauth Re: Unable to run netscan using task scheduler   17 June 2014, 02:50
Hi Andrew, I'm working with Tom Ryans on this issue. It is currently a PowerShell script that runs NetScan:

Start-Process -FilePath "D:\netscan\netscan.exe" -ArgumentList '/hide /config:d:\netscan\config.xml /auto:"d:\netscan\temp.xml"' -Wait -NoNewWindow

As he mentions, it works when running the script manually, but will hang indefinitely if run as a scheduled task.
 Uli Re: Unable to run NetScan using task scheduler   05 August 2014, 16:58
Problem is -- Netscan needs display out to run, which you don't have in a scheduler session. You can simulate it with
netscan > nul
You'll get an PopUp with "IO Error 105". The Pop Up blocks the scheduler threat. Have the same problem. Bug report was sent.
 Re: Unable to run NetScan using task scheduler   09 August 2014, 18:59 Admin Registered: 12 years ago Posts: 5 590
Thank you, we're investigating this.
 Carlo Re: Unable to run NetScan using task scheduler   07 February 2015, 03:30
Same problem, has anyone found a solution?
 Re: Unable to run NetScan using task scheduler   08 February 2015, 11:17 Admin Registered: 12 years ago Posts: 5 590
It was fixed in version 5.5.12.
 Carlo Re: Unable to run NetScan using task scheduler   10 February 2015, 04:06
It work using version 5.5.12 but not using last version 6.0.3
 Re: Unable to run NetScan using task scheduler   10 February 2015, 12:22 Admin Registered: 12 years ago Posts: 5 590
Well, I need to know the exact details on what you are doing using what system to be able to reproduce the case.
 Carlo Re: Unable to run NetScan using task scheduler   12 February 2015, 19:03
I create a scheduled task that points to a batch file. On a batch file i define a list of variables and i run netscan

Below is the command i use to launch netscan on a batch file:
start /wait %~dp0\64-bit\netscan.exe /hide /range:%Range% /Config:CONFIG.xml /auto:%~dp0\Dati\%FILE%.csv

I test it on Windows 2008 (64bit), Windows 2008 R2 and Windows 2012
Same batch work with netscan version 5.5.12, but not work with version 6.0.3
 Re: Unable to run NetScan using task scheduler   12 February 2015, 23:51 Admin Registered: 12 years ago Posts: 5 590
Could you perhaps replace start /wait with echo ... > file.txt for a test, so that I can see the exact command line passed to start?

Also, does your batch file work when launched manually (not from the Task Scheduler)?
 Carlo Re: Unable to run NetScan using task scheduler   13 February 2015, 21:55
I already do this test. The output file is Blank

And yes, my batch file work fine when launched manually.

below you can find my batch file:
@echo off

set Range=192.168.1.1-254
Set File=xxx

cls

IF EXIST %~dp0\Dati\%File%.csv (
IF "%PROCESSOR_ARCHITECTURE%"=="x86" (
@echo Merge 32 Bit
start /wait %~dp0\32-bit\netscan.exe /hide /range:%Range% /Config:STD-ZUC.xml /auto:%~dp0\Dati\%file%.csv /Merge
) ELSE (
@echo Merge 64 Bit
start /wait %~dp0\64-bit\netscan.exe /hide /range:%Range% /Config:STD-ZUC.xml /auto:%~dp0\Dati\%file%.csv /Merge
)
) ELSE (
IF "%PROCESSOR_ARCHITECTURE%"=="x86" (
@echo New 32 Bit
start /wait %~dp0\32-bit\netscan.exe /hide /range:%Range% /Config:STD-ZUC.xml /auto:%~dp0\Dati\%file%.csv
) ELSE (
@echo New 64 Bit
start /wait %~dp0\64-bit\netscan.exe /hide /range:%Range% /Config:STD-ZUC.xml /auto:%~dp0\Dati\%file%.csv
)
)

 Re: Unable to run NetScan using task scheduler   13 February 2015, 22:22 Admin Registered: 12 years ago Posts: 5 590
This line doesn't look quite correct.
set Range=192.168.1.1-254
It might have worked in the past, but it does no longer. Change it to
set Range=192.168.1.1-192.168.1.254

 Carlo Re: Unable to run NetScan using task scheduler   14 February 2015, 03:15
Yes i know.
but this file is only an exmple.

on my production i use this row

set Range=172.16.5.1-172.16.5.254

The problem is not Range variable.

I Repeat.
Same bach in scheduled task work with versione 5.5.12 bat not with version 6.0.3
 Re: Unable to run NetScan using task scheduler   16 February 2015, 11:57 Admin Registered: 12 years ago Posts: 5 590
It's not reproducible, that's all I can say at the moment. Perhaps the current directory is different when the batch file is launched by the Task Scheduler and then the Network Scanner can't find the config file or write the CSV output.

Grab the Process Monitor, set it to monitor I/O actvity from netscan.exe and see if that sheds light on the issue.
 John Re: Unable to run NetScan using task scheduler   13 March 2015, 07:12
 Re: Unable to run NetScan using task scheduler   13 March 2015, 13:46 Admin Registered: 12 years ago Posts: 5 590
Sorry, we don't keep old versions. You can search in Google or better yet, help us identify the issue by following the post above.
 Re: Unable to run NetScan using task scheduler   14 March 2015, 00:50 Registered: 2 years ago Posts: 4
I am having the exact same problem. Previously I was able to call the attached .bat file from the Task Scheduler, but since upgrading to 6.0.4, the netscan.exe process never exits. When I run the .bat file manually, the process runs fine and netscan.exe exits without any issues. I ran the process monitor for the same .bat file run manually and via the task manager and can send you the logs. Please let me know the best way to do this. Both logs are around 4.5MB. Any insight you could provide would be greatly appreciated. Thanks!
 John Re: Unable to run NetScan using task scheduler   14 March 2015, 03:10

In Version 6.03 and 6.04 we have the same behaviour as described from other editors before.
In the console the batch is working perfectly. But asa the batch is started by the taskplanner, it runs forever. Stopping the taskplanner - the batch process is killed immediately, the netscan.exe process is still active by doing nothing. I've tried several parameter to start the netscan process in the batch as well as different attributes of the task.

System: 2008R2 - German

Different batch commands used:
- Start /Wait netscan.exe /hide /config:%SysMonID%.xml /auto:%SysMonID%_Results.xml
- Start /Wait netscan.exe /config:%SysMonID%.xml /auto:%SysMonID%_Results.xml
- netscan.exe /hide /config:%SysMonID%.xml /auto:%SysMonID%_Results.xml
- netscan.exe /config:%SysMonID%.xml /auto:%SysMonID%_Results.xml

- hidden
- not hidden

All netscan options - incl. the IP range - are saved from the GUI
AutoUpdate was switched off and verified in the saved XML File

King regards from Hamburg
John
 Re: Unable to run NetScan using task scheduler   15 March 2015, 19:04 Admin Registered: 12 years ago Posts: 5 590
Looks like more people have this issue than it initially seemed. Could you guys please download this debug build, launch it from your batch file/scheduler and wait until in hangs?

Then there will be a log file in

c:\Users\Public\Documents\netscan.log

or

C:\Documents and Settings\All Users\Documents\netscan.log

 Re: Unable to run NetScan using task scheduler   16 March 2015, 06:59 Registered: 2 years ago Posts: 4
Hi Andrew - Attached is the requested log file. Please let me know if you need anything else.

Thanks,
Ryan
 Re: Unable to run NetScan using task scheduler   16 March 2015, 11:49 Admin Registered: 12 years ago Posts: 5 590
Ryan, thank you for posting. It looks interesting, but unfortunately we need more information to investigate the issue. I have added more logging, could you please download the fresh build and generate and post a new log?
 Re: Unable to run NetScan using task scheduler   16 March 2015, 23:36 Registered: 2 years ago Posts: 4
Sure thing - Here you go, Andrew.

Thanks,
Ryan
 Re: Unable to run NetScan using task scheduler   17 March 2015, 13:25 Admin Registered: 12 years ago Posts: 5 590
 Re: Unable to run NetScan using task scheduler   17 March 2015, 22:31 Registered: 2 years ago Posts: 4
Working like a charm now. Thanks so much for your help with this, Andrew!!
 John Re: Unable to run NetScan using task scheduler   19 March 2015, 05:30
Andrew, this is absolutely soft PERFECT! 6.05 is working fine in the scheduler now.
Thanks so much!

Kind regards from Hamburg
John
 Re: Unable to run NetScan using task scheduler   29 January 2016, 19:58 Registered: 1 year ago Posts: 4
Hello everyone!!

In first, many thanks for this famous free software!

However i have exactly the same problem with the last netscan version (v6.1.0.0 32 and 64 bits). In the console the batch is working perfectly. But when the batch is started by the taskplanner (in .bat), it runs forever... And it's very hard to find previous version. Someone with the same problem here?

Thanks all!
 Re: Unable to run NetScan using task scheduler   29 January 2016, 20:14 Admin Registered: 12 years ago Posts: 5 590
What's the exact command line you are using? Try supplying a config like this:
netscan.exe /config:C:\path\to\config.xml

 Re: Unable to run NetScan using task scheduler   29 January 2016, 20:28 Registered: 1 year ago Posts: 4
i'm using this command :

F:\NetScan\netscan.exe /hide /config:F:\NetScan\BEETA\ScanBEETA.xml /auto:"F:\NetScan\BEETA\BEETA_Scan_date_%dd%-%mm%-%yyyy%_Heure_%hh%-%nn%.htm"

And i have checked auto updates in the config file.
 Re: Unable to run NetScan using task scheduler   30 January 2016, 19:08 Admin Registered: 12 years ago Posts: 5 590
It's a bit of a mystery, so I have prepared a debug version.

When it hangs, there will be netscan.log created in the same folder. Please post it here.

Sometimes you can get the answer faster if you try the forum search and/or have a look at the software user manual to see if your question has already been answered.

Our forum rules are simple:

• Be polite.
• Do not spam.
• If possible, check your spelling and grammar.

Author:

Email:

Subject

A brief and informative title for your message, approximately 4–8 words:

Spam prevention: please enter the following code in the input field below.

  *******   **     **  ********  **     **  **     **
**     **  **     **  **    **   **   **   ***   ***
**     **  **     **      **      ** **    **** ****
********  *********     **        ***     ** *** **
**  **     **    **        ** **    **     **
**     **  **     **    **       **   **   **     **
*******   **     **    **      **     **  **     ** 

Message:

Online Store

Help & Support

Knowledge Base

Forum