Using a Windows Service to trigger wyUpdate.exe

Hi, I have built a Windows Service to trigger wyUpdate using AutomaticUpdaterBackend. I have used the code from your Windows Service demo project but I'm getting a "wyUpdate failed to start" error at the auBackend_UpdateFailed event.

My scenario is that I want to update multiple apps installed on remote client machines running windows XP and above. The apps are all installed initially by an IT Admin with Administrator rights on the machines. The machines are used by users with Limited User accounts who do not have read/write permissions on the Program Files folder where the apps are installed. We want to silently deploy new versions to the users with no user interaction/input.

I was hoping that a windows service could be used to run the wyUpdate.exe's at startup using the /fromservice switch. The wyUpdateLocation setting is set to point to the correct location of the exe (not the same directory as the service) but I always get the "wyUpdate failed to start" error. I have also tried copying the wyUpdate exe to the same directory as the service (and removed the wyUpdateLocation property) but I still get the same error. The service account is LocalSystem.

Is there any known issue with a windows service calling an exe (Windows 7)?Is this the best approach?

Regards

This is usually caused by not including the client.wyc file in the same folder as wyUpdate.exe. Try double clicking wyUpdate.exe. Does it show an error?

Is there any known issue with a windows service calling an exe (Windows 7)?

No. wyUpdate works from Windows app and Windows Services on Windows XP to Windows 8.

Is this the best approach?

Yeah, that's one approach that works.

Hi Wyatt, thanks for getting back to me. I have tried double clicking the wyUpdate.exe in the app's directory and it tells me there is a new version available and to click Update to get the new version. The app's directory is "C:\Program Files\TestApp". The Windows Service directory is "C:\Dev\TestWindowsService\bin\TestWindowsService.exe".

I have set the wyUpdateLocation property to point to C:\Program Files\TestApp\wyUpdate.exe. Client.wyc is also in this directory.

When the service tried to hit the wyUpdate.exe I get the "wyUpdate failed to start" error but it does seem to work if I double click the exe manually. As I say I have set the service to use a LocalSystem account so I'm not sure why it fails to start.

Regards

It's hard to say what's happening. Paste the snippet of code you're using to initialize wyUpdate.

Also, what are the versions of wyUpdate.exe and AutomaticUpdater.dll you're using?

Hi Wyatt, here is my code snippet for initializing the wyUpdate exe.

static void Main() { Run(new UpdateService()); }

protected override void OnStart(string[] args) { System.Diagnostics.Debugger.Break(); TimerCallback timercallback = timer_Elapsed; timer = new Timer(timercallback, null, 0, timerInterval);

auBackend = new AutomaticUpdaterBackend { //TODO: set a unique string. // For instance, "appname-companyname" GUID = "85578d7b-0487-4597-9caf-bc51a814007b", // With UpdateType set to Automatic, you're still in // charge of checking for updates, but the // AutomaticUpdaterBackend continues with the // downloading and extracting automatically. UpdateType = UpdateType.Automatic, wyUpdateLocation = @"C:\Program Files\TestApp\wyUpdate.exe", wyUpdateCommandline = " /fromservice", // We set the service name that will be used by wyUpdate // to restart this service on update success or failure. ServiceName = "UpdateService" }; auBackend.ReadyToBeInstalled += auBackend_ReadyToBeInstalled; auBackend.UpdateSuccessful += auBackend_UpdateSuccessful; auBackend.UpToDate += auBackend_UpToDate; auBackend.UpdateFailed += auBackend_UpdateFailed; auBackend.BeforeChecking += auBackend_BeforeChecking; auBackend.BeforeDownloading += auBackend_BeforeDownloading; auBackend.BeforeExtracting += auBackend_BeforeExtracting; auBackend.Cancelled += auBackend_Cancelled; auBackend.CheckingFailed += auBackend_CheckingFailed; auBackend.ClosingAborted += auBackend_ClosingAborted; auBackend.DownloadingFailed += auBackend_DownloadingFailed; auBackend.ExtractingFailed += auBackend_ExtractingFailed; auBackend.UpdateAvailable += auBackend_UpdateAvailable; auBackend.UpdateStepMismatch += auBackend_UpdateStepMismatch;

//TODO: use the failed events for logging & error reporting: // CheckingFailed, DownloadingFailed, ExtractingFailed, UpdateFailed

// the functions to be called after all events have been set. auBackend.Initialize(); auBackend.AppLoaded(); }

WyUpdate.exe is version 2.6.18.4. AutomaticUpdater.dll is also version 2.6.18.4

Thanks.

Hi Wyatt, the service I built has now started working although I'm not too sure why. The code hasn't changed since Friday but the PC has been rebooted so I'm not sure why that might have been causing problems but it is now working as expected so many thanks for you help.

Regards