IADsTSUserEx::TerminalServicesInitialProgram property

The path and file name of the application that the user wants to start automatically when the user logs on to the Remote Desktop Session Host (RD Session Host) server.

This property is read/write.

Syntax


HRESULT put_TerminalServicesInitialProgram(
  [in]  BSTR pNewVal
);

HRESULT get_TerminalServicesInitialProgram(
  [out] BSTR *pVal
);

Property value

The path and file name of the application.

Error codes

These methods support the standard return values, including S_OK. For more information, see ADSI Error Codes.

Remarks

To set an initial application to start when the user logs on, you must first set this property and then set the TerminalServicesWorkDirectory property. If you set only the TerminalServicesInitialProgram property, the application starts in the user's session in the default user directory.

Examples

The following example shows a script that binds to the Active Directory database without credentials.


Set DSO = GetObject("LDAP:")
Set usr = DSO.OpenDSObject(
    "LDAP://DOMAIN/CN=Test,CN=Users,DC=Server1,DC=Domain,DC=com")
Wscript.echo usr.TerminalServicesWorkDirectory
Wscript.echo usr.TerminalServicesInitialProgram
usr.TerminalServicesInitialProgram= "cmd.exe"
usr.TerminalServicesWorkDirectory= "D:\path"
usr.SetInfo
WScript.echo usr.TerminalServicesInitialProgram
Wscript.echo usr.TerminalServicesWorkDirectory


Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008

Header

Tsuserex.h (include Tsuserex.h or Tsuserex_i.c)

Type library

Tsuserex.tlb

DLL

Tsuserex.dll

See also

IADsTSUserEx

 

 

Show: