cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Charles_Donnis
Level 2

Running UpdateService from a service

I am trying to create a Windows service based application that uses UpdateService. However I cannot get it to work, it fails when i call AutoUpdate in both silent and non silent modes even if the service is logged in as an Administrator on the machine. If i run AutoUpdate from a standalone program it runs fine.

Has anyone got any ideas why this maybe happening?

Thanks
0 Kudos

(3) Replies
Brad_Peterson
Level 7

Could you post the source code that you are using to check for updates? That way, we can get a better idea of whats going on. I know many of us are able to get AutoUpdate working, myself included. It must be a simple coding mistake somewhere
0 Kudos
Charles_Donnis
Level 2

The code I use to run from the windows service and the code I use that runs the standalone program is exactly the same. The service in fact launches an executable that does the update and I can run that update as a standalone application. When I run it as standalone application it works, when I let the service launch it it doesnt. AutotUpdate fails when it runs from the service, and HRESULT is a very large -ve number which doesnt correlate to any windows error message.

Here is the code:

USES_CONVERSION;
VARIANT_BOOL bUpdateInitiated = VARIANT_FALSE;
CComBSTR productCode(szProductCode);
VARIANT_BOOL varbSilent;
if(bSilent)
{
varbSilent=VARIANT_TRUE;
}
else
{
varbSilent=VARIANT_FALSE;
}
HRESULT hr = m_spAgent->AutoUpdate(productCode, varbSilent, 0, 0,&bUpdateInitiated);
if(bUpdateInitiated==VARIANT_FALSE)
{
return (FALSE);
}
return TRUE;

It doesnt matter if I run the service as Admin or local system.
0 Kudos
Brad_Peterson
Level 7

Oh darn, I misread your earlier post. I didn't see you have two distinct setups here...a Windows service based application and a standalone application. If you can get it to work on a standalone application, then I'm stumped...I thought you just couldn't get anything to work at all.

I'd investigate this more, make a simple test case program, and then open up a MySupport request on this if it is a bug. Sorry I can't be of more help. 😞
0 Kudos