次の方法で共有


Specify a Program to Start Automatically When A User Logs On

Applies To: Windows Server 2008

By default, Terminal Services sessions provide access to the full Windows desktop, unless a program has been specified to start when the user logs on to the remote session.

If an initial starting program has been specified, it will be the only program that the user can use in the Terminal Services session. The Start menu and the Windows Desktop are not displayed when the user logs on to the remote session, and when the user exits the program the session is automatically logged off.

Note

Specifying an initial program to run does not apply to a RemoteApp session. For more information about TS RemoteApp, see the topic "Overview of TS RemoteApp" in the Windows Server 2008 TS RemoteApp Manager Help.

Configuring the initial starting program on a per-connection basis affects all users that use the connection.

You can configure the initial starting program on a per-user basis by using the Terminal Services Extension to the Local Users and Groups snap-in or to the Active Directory Users and Computers snap-in.

Initial starting program settings configured by using Terminal Services Configuration will take precedence over initial starting program settings that have been configured for a specific user account or that the user has specified in Remote Desktop Connection.

Use the following procedure to specify a program to start when the user logs on to a remote session.

Membership in the local Administrators group, or equivalent, is the minimum required to complete this procedure. Review details about using the appropriate accounts and group memberships at Local and Domain Default Groups (https://go.microsoft.com/fwlink/?LinkId=83477).

To specify a program to start when the user logs on to a remote session

  1. Open Terminal Services Configuration. To open Terminal Services Configuration, click Start, point to Administrative Tools, point to Terminal Services, and then click Terminal Services Configuration.

  2. Under Connections, right-click the name of the connection, and then click Properties.

  3. In the Properties dialog box for the connection, click the Environment tab.

  4. Configure the initial starting program settings as appropriate for your environment.

    If you select the Start the following program when the user logs on option, in Program path and file name, type the fully qualified path and file name of the executable file to be run when the user logs on. If necessary, in Start In, type the fully qualified path to the starting directory for the program. If you leave Start In blank, the program runs with its default working directory. If the specified program path, file name, or working directory is not the name of a valid directory, the terminal server connection fails with an error message.

  5. Click OK. Changes made on the Environment tab are not applied to sessions that are connected when the change is made. The changes will take effect the next time the user establishes a new connection to the terminal server.

You can also configure whether a program or the desktop appears when the user logs on to a remote session by applying the following Group Policy settings:

  • Start a program on connection

  • Always show desktop on connection

These Group Policy settings are located in the following locations:

  • Computer Configuration\Administrative Templates\Windows Components\Terminal Services\Terminal Server\Remote Session Environment

  • User Configuration\Administrative Templates\Windows Components\Terminal Services\Terminal Server\ Remote Session Environment

These Group Policy settings can be configured by using either the Local Group Policy Editor or the Group Policy Management Console (GPMC). Note that these Group Policy settings will take precedence over the settings configured in Terminal Services Configuration. If both the Computer Configuration and the User Configuration policy settings are configured, the Computer Configuration policy settings take precedence. Also, the Always show desktop on connection policy setting will take precedence over the Start a program on connection policy setting.

For more information about Group Policy settings for Terminal Services, see the Terminal Services Technical Reference (https://go.microsoft.com/fwlink/?Linkid=89673).

For information about starting a program on a per-user basis, see the topic "<UserAccount> Properties: Environment Tab " in the Windows Server 2008 Terminal Services User Properties Help.

Additional references