bright, fresh software
Downloads  |  Buy

Silent update via updater backend fails to execute a batch file on Win Server 2003 and 2008

Silent update via updater backend fails to execute a batch file on Win Server 2003 and 2008

Postby JoelLee » April 26th, 2012, 4:00 pm

We have a windows service that is deployed on various customer machines that are running Windows XP, Windows Server 2003, and Windows Server 2008. The service uses wyUpdate to update itself when we publish updates. This has been working fine for about six months. Recently, we added for the first time a .bat file to the Temporary Folder, to be executed after the update is applied and rollback if any non-zero error is returned due to execution of the batch file.

This was tested successfully on two of our own Windows Server 03 and 08 machines, by logging in to the server, stopping the service manually, and then clicking on wyUpdate.exe. The update is applied and the batch file runs successfully.

However, whenever a runnning service calls the updater backend, the update fails on Windows Server 03 and 08 machines. Based on several tests that I conducted, it does not seem to have anything to do with the batch file content. For example, in my most recent tests, the batch file consists of a single line: "@echo off". The error being reported by the updater backend is: 'Failed to execute the file "C:\Users\fictitioususer\wc\9\temp\temp.bat": No such interface supported'.

This problem does not occur on machines running Windows XP.

Any thoughts?
JoelLee
 
Posts: 4
Joined: April 26th, 2012, 3:18 pm

Re: Silent update via updater backend fails to execute a batch file on Win Server 2003 and 2008

Postby JoelLee » April 26th, 2012, 4:35 pm

Did some additional testing. This also occurs if the temp file to execute is a do-nothing .exe. If I watch the folder where the updates are being downloaded, I can see that the .exe file (or .bat file in previous tests) is, in fact, being downloaded. It just fails to execute.
JoelLee
 
Posts: 4
Joined: April 26th, 2012, 3:18 pm

Re: Silent update via updater backend fails to execute a batch file on Win Server 2003 and 2008

Postby Wyatt » April 26th, 2012, 4:42 pm

Hey Joel,

What's the error that's returned when the *.exe fails to execute? (Copy and paste the full error).

Is the exe a valid executable?
User avatar
Wyatt
Site Admin
 
Posts: 2563
Joined: July 11th, 2007, 10:30 pm
Location: New Hampshire

Re: Silent update via updater backend fails to execute a batch file on Win Server 2003 and 2008

Postby JoelLee » April 26th, 2012, 7:22 pm

The error is essentially the same, but with the name of the .exe instead of the batch file name:

'Failed to execute the file "C:\Users\fictitioususer\wc\9\temp\updatetest.exe": No such interface supported'

The .exe is a valid executable. It is a console app that simply takes any command line arguments passed to it, and writes them to a file. The command line args passed to the app from wyUpdate are %basedir% %versionfrom% %versionto%. It does not output anything to the console. The app runs fine from the command line. If you want, I can do another test where the .exe does nothing at all. I don't think that will make a difference, however.

Things I have considered:

(1) Security issues, e.g. maybe the OS will not run an exe or bat file if it doesn't know where it came from. But if that were the case, I would expect to have problems running wyUpdate manually as well.

(2) Permission issues. When I run wyUpdate manually I am logged in as a different user than the service runs under when it tries to update itself. That would suggest some sort of permissions error. However, the service runs under an account that is an admin on the machine where it runs, so that seems unlikely.

(3) Console app attempting to interact with the desktop when running as a service. The service runs under a specific user account (i.e., not local System). When running a Windows service under the Local System account, there is an option on the service Log In dialog to "allow service to interact with desktop". This option is not available when running under a specific user account. From that I am assuming that Windows would consider it an error if the app tried to interact with the console. As I said, the app does NOT write to the console. But I am not sure what the OS does when it starts the app, such as attempt to create a console window. Perhaps that causes an error from the get-go. I can run a test tomorrow by running the service under the Local System account, with the "interact with desktop" option enabled, and see if the updater fails under those conditions as well.
JoelLee
 
Posts: 4
Joined: April 26th, 2012, 3:18 pm

Re: Silent update via updater backend fails to execute a batch file on Win Server 2003 and 2008

Postby Wyatt » April 26th, 2012, 8:32 pm

I've emailed you.
User avatar
Wyatt
Site Admin
 
Posts: 2563
Joined: July 11th, 2007, 10:30 pm
Location: New Hampshire

Re: Silent update via updater backend fails to execute a batch file on Win Server 2003 and 2008

Postby JoelLee » April 27th, 2012, 1:29 pm

Thanks, Wyatt. I got your email.

I've sent a detailed reply, but for purposes of this discussion, I'll just point out that the documentation says that we should run services under the LOCAL SYSTEM account. We did that initially, but later on we started running the service as a domain user that is has admin privileges and has "log in as a service" rights. That works fine as long as we don't try to run anything from the temp folder. Since we really need to use a domain user for the service, we will probably figure out a way to run update scripts from the service itself.

Thanks for your help.
JoelLee
 
Posts: 4
Joined: April 26th, 2012, 3:18 pm

Re: Silent update via updater backend fails to execute a batch file on Win Server 2003 and 2008

Postby Anand Kumar » March 16th, 2013, 2:38 am

Hi JoelLee / Wyatt

could you kindly post a sample code for Silent update via updater backend to execute a batch file(sql scripts) ?
i am unable to find the solution , i had use your windows service silent update application for updating batch file.
but service not updates automatically.

thank you
Anand Kumar
 

Re: Silent update via updater backend fails to execute a batch file on Win Server 2003 and 2008

Postby Wyatt » March 16th, 2013, 6:38 am

Anand, we've covered this a dozens of times in this forum. Plus we have a FAQ item on it, see: Can I update databases (Microsoft SQL Server, MySQL, etc.) as part of my update?

If you get a specific error then tell me what it is. Saying something doesn't work is not nearly enough information.
User avatar
Wyatt
Site Admin
 
Posts: 2563
Joined: July 11th, 2007, 10:30 pm
Location: New Hampshire


Return to wyBuild, wyUpdate, & AutomaticUpdater Support