Let's say I have a Windows service called "MyService" and an executable file called "MyEXE" located on several computers on my network.
Is it possible (from within "MyService") to run multiple instances of "MyEXE" on another / the same computer, perform some task and return a true / false result to the callback method in "MyService"?
Something like that
class MyService : ServiceBase
{
delegate void UpdateCallBack(int id, bool updated)
void CheckForUpdates()
{
bool updatesExist = someService.GetCurrentVersion() != currentVersion;
if(updatesExist)
{
UpdatePC("C:\Program Files\MyApp.exe", 1, UpdateComplete);
UpdatePC("\\somepc\Program Files\MyApp.exe", 1, UpdateComplete);
UpdatePC("\\mypc\Program Files\MyApp.exe", 1, UpdateComplete);
}
}
void UpdatePC(string filePath, int id, UpdateCallBack callback)
{
SomeEXERunner runner = new SomeEXERunner();
runner.Run(filePath,"-u",id,callback);
}
void UpdateComplete(int id, bool updated)
{
if(!updated)
EmailService.NotifyAdmin("PC Not updated", id);
}
}
Maybe I'm wrong in the whole architecture!
source
share