Is it possible to launch a web browser from a windows service? I have created a basic service in C# and installed it under the “LocalSystem” security profile.
The code for the service looks as follows:
namespace Bootloader
{
public partial class Service1 : ServiceBase
{
public Service1()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
string target = "http://www.microsoft.com";
System.Diagnostics.Process.Start(target);
}
protected override void OnStop()
{
}
}
}
When the service runs, nothing happens. The documentation on windows service say that they do not have any UI, but does that mean launching a web browser is not possible.
It’s possible only in XP and lower. In Vista, Windows Services run on a separate desktop completely. You’ll have to have something running in the user’s desktop to accomplish this.
Write an app with a hidden window that starts at startup as a workaround.