CopyFile API fails with AT command

CopyFile API fails with AT command

I have a program that copies a file from Network Drive W: to Local Hard Drive E: using the CopyFile API Function. From the command line, the program works flawlessly. But, schedule the program to run with the AT command, and CopyFile fails with Error #5, “Access is Denied.”

I entered in this AT command from the command-line while logged in as Administrator:

at 11:01 /interactive “e:dataatdbu.bat”

The BAT file calls my EXE with the From/To parameters to feed to the CopyFile API function.

The “everyone” group has “Full Control” access to the file being copied and the directory it lives in. The destination directory is on a FAT drive.

By the way, the program works fine if I’m copying the file from one local hard drive to another, from the command-line or from AT.

You have run into one of those basic, but unobvious, security features of NT. AT jobs will NOT run under the security context of the user requesting it (even if you are an administrator). They will run under the security context of whatever you have the Schedule service running under, which is normally the System account. This account has 100% control over the local machine and drives, and 0% control over network drives. The best choice may be to set the Schedule service to run under the account of an account that does have rights to copy the network files.

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several