Why won't my .BAT file run on Windows Server 2012 R2

Paul Kraemer 266 Reputation points
2022-01-13T22:25:13.923+00:00

Hi,

I have administrative access to a PC running Windows Server 2012 R2. This PC is acting as a Remote Desktop Server. We use this Remote Desktop Server to provide remote access to a few database applications we use. At times, we run a .BAT file that records some date and time information to a log file and then opens a particular MS Access database that automatically runs some code to perform the actions we want and then closes automatically. The .BAT file ends with a Pause command, so when it runs, it completes with the command prompt open and prompting "Press any key to continue". Our exact .BAT file is as written below...

echo %date% >> itsact.log

echo %time% >> itsact.log

echo Executing Update >> itsact.log

"C:\Program Files (x86)\Microsoft Office\Office15\MSACCESS.EXE" "q:\NJ\AutoInventorySync2003.accdb"

echo Finished >> itsact.log

pause

... Today, when I started a remote desktop session. This .BAT file would not run. Whether I double-clicked on it or right-clicked and chose "Run as Administrator", absolutely nothing would happen - the command prompt wouldn't open, Access wouldn't open, and nothing would be written to the log file. This has happened on a number of different days after I initially established my connection.

When this happens, I've noticed that if I manually open a command prompt and type in the fourth line of the .BAT file (the one that opens Access), Access opens the requested database and the desired actions are performed. After I do this one time, I am then able to run the .BAT file and it works as expected as many times as I wish to run it. I believe when I first did this, Access did open with a message saying that active content had been disabled, to which I chose to enable it.

I was wondering if anyone here can think of a reason why the .BAT file would not run until I manually open up the database at least one time?

To take this a step farther, our actual setup is such that rather than having to run this .BAT file manually, it was previously called automatically by a utility we run that exists as an .exe file. I do not have the source code for this .exe file, but I am certain that it previously would write some data to a text file and then initiate the above .BAT file. It is currently still writing data to the text file, but it is no longer initiating the .BAT file.

I suspect this must have something to do with a security setting that was changed on this PC (we did recently have some new IT personnel make some changes to enhance our security) or something that has changed due to a software update, upgrade, or patch that might have been applied. I am having a hard time figuring out exactly what is preventing this .BAT from running.

Any advice or suggestions will be greatly appreciated.

Thanks in advance,

Paul

Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
894 questions
0 comments No comments
{count} votes

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.