.CMD script runs slowly when started on the file server via UNC

Emmanuel Meekers 1 Reputation point
2022-09-13T07:08:01.843+00:00

Hi,

We have a script that is started remotely (\myserver\myshare\myscript.cmd).
When starting the script from another server, it runs at a normal speed.
When starting the same script on the file server (myserver) via the local path (d:\mysharedfolder\myscript.cmd), it runs at the same speed.

But when starting the script via the UNC path (\myserver\myshare\myscript.cmd) on the file server, it runs very slowly.

Tested with Windows 2016, 2019 and 2022

Does someone knows the reason for this? Can this be prevented?

Thanks

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,898 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 44,206 Reputation points
    2022-09-19T06:56:27.53+00:00

    Hello there,

    It is difficult to find the reason without looking into your script. Your script might include functions that might scan files and this function might take time to get executed via the UNC path.

    If you are using FINDSTR in your script it must scan the files on all UNC paths. This means the entire content of every file must be transmitted across your network. Grab ProcessExplorer (or Procmon) and watch what happens when the .bat is started. You should be able to tell if there's some kind of lag caused by the batch file or if it's something else. Depending on the type of executable file, you might also have some kind of concurrency issue going on.

    Process Monitor is an advanced monitoring tool for Windows that shows real-time file system, Registry, and process/thread activity. You can get the tool from here https://learn.microsoft.com/en-us/sysinternals/downloads/procmon

    -------------------------------------------------------------------------------------------------------------

    --If the reply is helpful, please Upvote and Accept it as an answer–

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.