calling wyupdate.exe from windows service

I am currently trying to call wyUpdate.exe from a windows service using Process.Start()

It works perfectly when I have it in the main function of my service, but once I put it inside a thread run by OnStart, it always returns 0 ( no updates )Since there is only the C++ version, I don't know if I'm doing something wrong...

Here is the snippet where I am getting 0 instead of 2 Dim pInfo As New ProcessStartInfo() pInfo.FileName = "C:\wyUpdate.exe" pInfo.Arguments = "/quickcheck /justcheck /noerr" Dim p As Process = Process.Start(pInfo) p.WaitForInputIdle() p.WaitForExit()

file.WriteLine(p.ExitCode().ToString())

Thanks

The code looks good., What happens when you double click wyUpdate.exe?

It runs normally and asks if I would like to continue installing updates.

I think the problem is with Windows Service in Vista and newer. It runs in "session0" so I don't think it can run any exe's, but your tutorial suggest otherwise so I was hoping to get some help here.

wyUpdate works fine from services. My guess is there's something wrong in your code, or you're referencing an instance of wyUpdate that has already been updated.

Try copying & pasting the code into a console app that runs in a regular user session. Try remocing p.WaitForInputIdle().

That is what's confusing me. It runs perfectly fine in a console app, it returns 2. When I run it manually, it also requests updates.

The snippet I showed you is all that is getting run inside my service, it doesn't help that you guess there is an error here ..

Also, it seems like removing p.WaitForInputIdle() is not helping

There's likely another instance of wyUpdate running in the background, hence the error. Close all instances of wyUpdate (in every session and every user) and then try it again.) https://wyday.com/forum/t/1805/problem-updating-service/

No, it works when I import the methods via importdll used in the C++ example.I don't have another wyupdate instance running.