Managed Terminal Services::ControlConnection

The method enables or disables incoming Terminal Services connections for the specified server. In addition, when connections are disabled, this method also immediately terminates all existing sessions. This may result in loss of data in those sessions.

This setting would be manually controlled by right-clicking on the connection in the Terminal Services Connection Configuration snap-in and selecting 'All actions'/'Enable connection' or 'Disable connection'.

In order for this method to successfully execute, either

  • The MPF service account (domain\MPFServiceAcct) must have administrator privileges on the specified terminal server, or

  • The request must include the username and password of a domain user with administrator privileges on the specified terminal server.

Arguments

Input Arguments Required Description

<server>

Yes

The name of the server on which the connection is to be enabled or disabled

<action>

Yes

The action to be performed: "enable" or "disable"

<preferredDomainController>

Yes

The name of the preferred domain controller to be used to check the permissions of the caller

<userName>

No

The name of a domain user with local administrator privileges on the specified server. This should be in the form "domain\username". If not specified, no credentials are sent, and the MPF Service Account must have administrative privileges on the specified server.

<password>

No

The password of the specified administrator. Required if userName has been specified.

<connectionName>

No

The name of the Terminal Services connection to be controlled. If not specified, the name "RDP-Tcp" is used.

Remarks

Security

Permitted to DomainAdmins only

Sample Code

Example XML Request

<request> 
  <procedure> 
    <execute namespace="Managed Terminal Services" 
             procedure="ControlConnection"> 
      <executeData> 
        <server>TheServer</server> 
        <userName>Fabrikam\admin1</userName> 
        <password>mypassword</password> 
        <action>disable</action> 
        <connectionName>CustomRDP</connectionName> 
        <preferredDomainController>dc1</preferredDomainController> 
      </executeData> 
    </execute> 
  </procedure> 
</request> 

Applies To

Terminal Services Namespace

See also

Tasks

Managed Terminal Services::ControlServer
Managed Terminal Services::ControlSession
Managed Terminal Services::ControlRemoteDesktop