Why restarting the Timer Service during System check?

May 2, 2008 at 3:42 PM
- During the system check, the setup.exe is actually stopping the Timer Service (SPTimerV3) and then starting it back, just to check if the timer service is running or not.
And, when doing an error is thrown, it assumes the service is not running.
Why does the setup.exe needs to restart the timer service?

- When I run the setup.exe on a Windows 2008 box, I get the following error log:
Cannot open SPTimerV3 service on computer '.' System.InvalidOperationException: Cannot open SPTimerV3 service on computer '.'. ---> System.ComponentModel.Win32Exception: Access is denied.
--- End of inner exception stack trace ---
at System.ServiceProcess.ServiceController.GetServiceHandle(Int32 desiredAccess)
at System.ServiceProcess.ServiceController.Stop()
at CodePlex.SharePointInstaller.SystemCheckControl.TimerServiceCheck.DoExecute().

Why do I get the error on a 2008 box?

Note:
- The account running the setup.exe has full control of the box, and that account can actually restart the service manually.
Developer
May 12, 2008 at 1:46 PM
Sounds like testing on Windows 2008 is something that should be done.  We may want voluteers to help with this.


nat wrote:
- During the system check, the setup.exe is actually stopping the Timer Service (SPTimerV3) and then starting it back, just to check if the timer service is running or not.
And, when doing an error is thrown, it assumes the service is not running.
Why does the setup.exe needs to restart the timer service?

- When I run the setup.exe on a Windows 2008 box, I get the following error log:
Cannot open SPTimerV3 service on computer '.' System.InvalidOperationException: Cannot open SPTimerV3 service on computer '.'. ---> System.ComponentModel.Win32Exception: Access is denied.
--- End of inner exception stack trace ---
at System.ServiceProcess.ServiceController.GetServiceHandle(Int32 desiredAccess)
at System.ServiceProcess.ServiceController.Stop()
at CodePlex.SharePointInstaller.SystemCheckControl.TimerServiceCheck.DoExecute().

Why do I get the error on a 2008 box?

Note:
- The account running the setup.exe has full control of the box, and that account can actually restart the service manually.



May 12, 2008 at 3:51 PM
- I found out what is the problem with Windows Server 2008. 
- The setup.exe was not able to recognize the new User Account Control (of Vista/Windows 2008) security model, and its defaulted to run in the least privilege level possible, which is the reason why it could not stop the timer service.
- A quick fix would be to manually change the “Privilege Level” of the setup.exe file, by letting it run as an administrator (from properties window).
- A better fix would be to add UAC manifest when building the setup.exe. See http://blogs.msdn.com/shawnfa/archive/2006/04/06/568563.aspx, for more information.

- But the question why the setup.exe restarts the Timer Service remains unknown. 

Thanks,
Nat
May 30, 2008 at 6:40 PM
Could be the timer service is being restarted, in order to avoid the "Cannot add the specified assembly to the global assembly cache" error that can occur during deployment of an assembly to the GAC, because the timer could have the file locked.
Jun 26, 2008 at 1:18 PM
Edited Jun 26, 2008 at 1:19 PM
It makes sense to restart the Timer Service in order to ensure that it is properly running. The Timer Service is responsible for executing scheduled task in SharePoint. Deploying a solution is a scheduled task which, in this case, is executed immediately. My guess would be that the Timer Service is taking care of this as well.
Sep 23, 2008 at 2:06 PM
I was just about to add a comment on this; why is the timer REstarted?  Would it not be sufficient to check its status is ServiceControllerStatus.Running ?$0I've also had the same issue on a Vista machine running WSS (http://community.bamboosolutions.com/blogs/bambooteamblog/archive/2008/05/21/how-to-install-windows-sharepoint-services-3-0-sp1-on-vista-x64-x86.aspx) where the Solution Installer said the timer service wasn't running.  I believe it's permissions as well.  I will have a 2008 machine setup soon to test on.$0