Start service interactively (Windows Vista, 7, Server 2008)

Windows services are generally console applications that are designed to run silently; they do not typically have user interface.

However, the service may require interaction with the user in some cases. Application as Service possesses advanced options that let you run services interactively (visible to users):


Choosing User Session

Windows XP, 2000, 2003, Vista, 7, Server 2008


Starting from Application as Service v.4.0, you can choose the user session to start your interactive service in, provided multiple users are concurrently logged on. In other words, you can choose the session in which the window of your interactive service will be visible. 

1. First of all, make sure that you ticked “Interaction with desktop” checkbox when creating a new service. Otherwise, the service will be launched in the background and without UI. This option is disabled by default.

2. Once the service is created, find it in Services list, right-click it and choose “Start service” option from the context menu.

3. The following dialog will be invoked permitting to choose the session:

Windows XP

img

If you tick “Remember my choice for future startups” checkbox, Application as Service will remember your choice, and the next time you start this interactive service, it will be started in this very session.

img

Additionally, you can restrict or grant your service certain privileges. To do this, choose the user account under which the service will run. Read ‘Running interactive services under user account‘ section below.
 

Starting Interactive Services in RDP Session

Windows XP, 2000, 2003, Vista, 7, Server 2008


Remote clients, connected to your PC via RDP, can choose the session in which the interactive service will run.

Windows XP

img

Windows 7

img

If Console session is chosen (the actual session of the server), the interactive service will be started, but its UI will not be visible on the client side.

Running Interactive Services

Windows Vista, 7, Server 2008


Windows Vista, Windows 7 and Windows Server 2008 have some security peculiarities that make problematic using “Interaction with desktop” feature of Application as Service.

In earlier versions of Windows OS (XP, Server 2003, etc.) services and user applications run together in Session 0.

Starting from Windows Vista, services are isolated in Session 0, while user applications run in subsequent sessions – Session 1, 2, etc. Thus, Session 0 becomes non-interactive. You can find more info about Session 0 Isolation at http://msdn.microsoft.com/en-us/library/bb756986.aspx

As services on Windows Vista, 7 and Server 2008 never run in the same session as user applications, services with UI (interactive services) are no longer immediately visible when you create them.

To make services with UI immediately visible when you create them, they should run in Windows session higher than 0. Once the service is created, find it in Services list, right-click it and choose “Start service” option from the context menu.

The following dialog will be invoked permitting to choose the session:

Windows 7

img

Choose the session other than 0 and click OK. Your interactive service will be started together with its UI.

If the required session is unavailable, the default one (zero) will be used.

Though, you can still start your interactive service in Session 0. Its UI will not appear right away; and you will have to take these steps to make it visible:

1. Invoke the Command Prompt window (Start –> Run –> cmd.exe).

2. Execute the following two commands to start Windows “Interactive Services Detection” service:

sc config UI0Detect start= auto

net start UI0Detect

3. You will see the Interactive Services Detection dialog pop up.

Click “View the message” and your interactive service will be launched:

img

Running Interactive Services under User Account

Windows XP, 2000, 2003, Vista, 7, Server 2008


Starting from Application as Service version 4.0, you can run services under user account still permitting them to interact with the desktop.

The main benefit of running services under user account is that the service gets all the privileges which this user possesses, for example, it can gain access to certain computer resources (network, catalogs, etc.), which is impossible if the service runs under system account.

Note!

The user will be granted the following privileges to be able to start and run interactive services:

1. Log on as a service

2. Replace a process level token

3. Adjust memory quotas for a process

You can read in detail about User Rights Assignment at this page: http://msdn.microsoft.com/en-us/library/cc780182

To choose the user account under which the interactive service will run, go to Service tab (“Account” option):

img