Batch file on network drive only works on some machines

Page 1 of 3 123 LastLast

  1. Posts : 11
    Windows 10
       #1

    Batch file on network drive only works on some machines


    Hello.

    I am having a very strange problem I have not been able to solve. I have a Windows 10/11 network with a mix of desktop and laptop machines. All of the machines are connected to a Synology NAS sever which is where the network data is stored.

    From this network some of the machines are Apache web servers, some are FTP servers, and some are support processors. Ther are a total of 8 machines.

    All of the machines map the SYSTEM account to the network drive Z; at startup with a Windows Task batch file with one command: net use z: \\networkdrive\web /user:username password /persistent:yes

    This works and is necessary to allow Apache server to find the root directory and log files on network drive Z: All the Apache services work fine so I know the map is fine.

    What doesn't work is my AWSTats report batch file. It works fine on 3 of the 8 machines, two of which are Windows 10. The batch file is run from network drive Z: The AWStats command line is:

    c:\perl64\bin\perl z:/awstats/tools/awstats_buildstaticpages.pl -awstatsprog=z:/awstats/wwwroot/cgi-bin/awstats.pl -update -config=configname -dir=z:/awstats/wwwroot/reports

    which is being called from a recurring Windows task from network drive Z:

    Perl is on the local C: drives of each machine but there is no AWStats data on the local drives. It's all on the network drive along with the Apache logs.

    This command line fails on 5 of the 8 machines with a syntax error, but AWStats is not telling me what the error is. There is no single common denominator that I can find among all 8 machines. Some are laptops, some are desktops, some are Windows 10, some are Windows 11.

    All of the machines have the exact same PATH and PATHEXT with the relevant C: and Z: directories in the path. All of the machines login with the same username. The web directories have EVERYONE permission.

    I've tried moving all the data (web logs and AWStats configs) to the local C: drive and that didn't fix it.

    What would cause the exact same batch file called from a network drive to run fine on some machines and fail on others? What else can I look at?

    Thanks
    Last edited by Leora; 23 Jun 2023 at 14:54.
      My Computer


  2. Posts : 1,746
    Windows 10 Pro x64 22H2
       #2

    I think you need to update your perl script to report line number at which it fails.

    In other words you need debugging and logging facility.
    You want to make sure that your script at the end writes something like "all operations completed successfuly"
    and you want to make sure this is the case for all computers or otherwise the script should log an error.
      My Computer


  3. Posts : 11
    Windows 10
    Thread Starter
       #3

    zebal said:
    I think you need to update your perl script to report line number at which it fails.

    In other words you need debugging and logging facility.
    You want to make sure that your script at the end writes something like "all operations completed successfuly"
    and you want to make sure this is the case for all computers or otherwise the script should log an error.
    Thank you. The Perl scripts are AWStats and cannot be updated. Perl is Acrtive Perl 5.28 on all machines which is a fairly recent version. I already know what the failure is. I just don't know the cause. The cause is clearly something to do with Windows.

    This version of Perl will run any other Perl script I have tried that is not AWStats.
      My Computer


  4. Posts : 1,746
    Windows 10 Pro x64 22H2
       #4

    How do you know it's syntax error if AWStats is not telling you what the error is?
    Can you take a screenshot of the syntax error?
      My Computer


  5. Posts : 11
    Windows 10
    Thread Starter
       #5

    zebal said:
    How do you know it's syntax error if AWStats is not telling you what the error is?
    Can you take a screenshot of the syntax error?
    This is a portion of the output. When AWStats runs and fails the output is:

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

    Z:\AWStats\wwwroot\reports>del /Q *.*

    Z:\AWStats\wwwroot\reports>c:\perl64\bin\perl z:/awstats/tools/awstats_buildstaticpages.pl -awstatsprog=z:/awstats/wwwroot/cgi-bin/awstats.pl -update -config=configfilename -dir=z:/awstats/wwwroot/reports
    Launch update process : "z:/awstats/wwwroot/cgi-bin/awstats.pl" -config=configfilename -update -configdir=
    ----- awstats 7.8 (build 20200416) (c) 2000-2018 Laurent Destailleur -----
    AWStats is a free web server logfile analyzer to show you advanced web
    statistics.
    AWStats comes with ABSOLUTELY NO WARRANTY. It's a free software distributed
    with a GNU General Public License (See LICENSE file for details).

    Syntax: awstats.pl -config=virtualhostname [options]

    This runs awstats in command line to update statistics (-update option) of a
    web site, from the log file defined in AWStats config file, or build a HTML
    report (-output option).

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

    It seems that AWStats is telling me there is a syntax error here. I have since upgraded to version 7.9 and that didn't fix it.

    Configdir= should show the directory name. It is specified on the command line. I don't know why it is cut off in the fail output.
      My Computer


  6. Posts : 1,746
    Windows 10 Pro x64 22H2
       #6

    Leora said:
    Configdir= should show the directory name. It is specified on the command line. I don't know why it is cut off in the fail output.
    I suspect that's because it's interpreted as file rather than directory, try adding a slash at the end ex:
    Code:
    dir=z:/awstats/wwwroot/reports/
      My Computer


  7. Posts : 11
    Windows 10
    Thread Starter
       #7

    zebal said:
    I suspect that's because it's interpreted as file rather than directory, try adding a slash at the end ex:
    Code:
    dir=z:/awstats/wwwroot/reports/
    Just for giggles I tried with the trailing slash. It made no difference. This batch job runs successfully as it on 3 of 8 Windows computers. Two sets of these machines are identical. One is a twin set of HP desktops. The other a twin set of ASUS laptops.

    One of each twin runs the batch job, one of each twin fails.

    I've already looked at inetcpl.cpl and reduce Internet and Intranet security to the lowest level to make sure that everything can execute.
      My Computer


  8. Posts : 1,746
    Windows 10 Pro x64 22H2
       #8

    If it's indeed syntax error then that's the syntax:
    Leora said:
    Syntax: awstats.pl -config=virtualhostname [options]
    However your command is not according to the syntax:
    awstatsprog=z:/awstats/wwwroot/cgi-bin/awstats.pl -update -config=configfilename -dir=z:/awstats/wwwroot/reports
    It should be:
    awstatsprog=z:/awstats/wwwroot/cgi-bin/awstats.pl -config=configfilename -update -dir=z:/awstats/wwwroot/reports
    Other than this I see no other issues from information you gave so far.
    It's difficult to know because cause it's completely unknown.
      My Computer


  9. Posts : 11
    Windows 10
    Thread Starter
       #9

    zebal said:
    If it's indeed syntax error then that's the syntax:


    However your command is not according to the syntax:


    It should be:


    Other than this I see no other issues from information you gave so far.
    It's difficult to know because cause it's completely unknown.
    I've been working on this for weeks.
      My Computer


  10. Posts : 1,746
    Windows 10 Pro x64 22H2
       #10

    Is it possible to post code of your batch script which is run by task scheduler?
    Only relevant portion including line breaks
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 13:11.
Find Us




Windows 10 Forums