Cannot copy batch file from network drive
I've got a strange problem that I can't find others reporting online. I am unable to copy a batch file from a network drive on Windows 10. However, it works in a few corner cases, but I can't figure out what the pattern is that allows it to work, nor what's causing it to fail the rest of the time.So, the batch file is on a DFS share, say \example.com\path\to\file.bat, and I want to copy it somewhere (anywhere) to my C: drive, say my Downloads folder.
One of the weird things is the error message. If I use file explorer, it says "Make sure you are connected to the network and try again." If I use command line to copy, it says "The specified network name is no longer available." As deep as I dig, it seems like the process thinks the network connection disappears when it gets to a batch file, but only for batch files (or zip files that contain batch files).
Here's the examples or characteristics of failure I've observed:
- Copying the file itself fails.
- Copying a zip file that contains a batch file fails.
- Failure has been observed on 20H2, 21H1, and 21H2.
- Failure has been observed both on non-domain joined (in audit mode preparing a new image for our organization) and on domain-joined computers.
- Failure occurs even when Windows Defender is completely disabled via the local policy editor.
- Failure occurs regardless of whether using a UNC path or mounting the path as a drive letter first.
And then there's a few counter-examples:
- Copying a zero-byte batch file works fine.
- If I copy in the opposite direction (from the computer to the network), it gives me the message "Make sure you are connected to the network and try again." However, the file does actually copy, albeit I have to refresh to see it.
- The file copy works fine for me from my primary workstation at work, as well as for a coworker with similar rights. However, it does not work for lower-tier IT coworkers using the same version of Windows on similarly-imaged devices.
Regarding that last part, the closest I've come to a pattern is that it works on domain-joined computers (using the same domain as the DFS servers) where the user copying the file is both a local administrator and has read-write access to the remote share. Our lower tier technicians that have local admin and read-only access to the remote share cannot copy the file. And in audit mode (hence not domain joined, but using the administrator account), I cannot copy the file to the machine despite the fact that I'm authenticating to the network as myself (with read-write access to the target share).
Any ideas what mechanism is causing this and how to get around it? I've never observed this until sometime in the past year. I'm baffled by how particular the issue is, seeing as how Windows is reporting it as a network drop when trying to copy only this one file type. And deep inspection of zip files makes me think it's antivirus, but with it still working with Windows Defender disabled or for certain users, that shouldn't be it (unless it's not really disabled all the way, despite what it says).
By the way, I've already tried the various "DISM /Online /Cleanup-Image ..." and "sfc /SCANNOW" commands. Shouldn't need to anyway since my VM in audit mode is a fresh install of Windows with only a few small programs installed.
Sign in to comment