TerminalServicesProvider::ControlRemoteDesktop

The ControlRemoteDesktop method configures the specified terminal server to allow or disallow new Terminal Services connections. When disallowed, existing sessions are unaffected, but creation of new sessions is prevented.

This setting would be manually controlled by setting or clearing the Enable Remote Desktop checkbox on the MyComputer->Properties->Remote tab on the machine in question.

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 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".

<userName>

No

The name of a 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

Rollback

Yes - the original state of the connection is restored on rollback.

Underlying API

Enable Method of the Win32_Terminal Class

Sample Code

Example XML Request

<request> 
  <procedure> 
    <execute namespace="Terminal Services Provider" 
             procedure="ControlConnection"> 
      <executeData> 
        <server>TheServer</server> 
        <action>disable</action> 
        <connectionName>CustomRDP</connectionName> 
      </executeData> 
    </execute> 
  </procedure> 
</request> 

Applies To

Terminal Services Provider