TerminalServicesProvider::SetUserConfiguration
The SetUserConfiguration method sets Terminal Services-related user settings for the specified user in Active Directory or on the specified Terminal server. This is the method to use to grant or deny individual user access to Terminal Services at the domain level or alternatively at the individual server level.
The user settings that can be controlled through the SetUserConfiguration method are listed here:
InitialProgram
WorkingDirectory
fAllowLogonTerminalServer
TimeoutSettingsConnections
TimeoutSettingsDisconnections
TimeoutSettingsIdle
fDeviceClientDrives
fDeviceClientPrinters
fDeviceClientDefaultPrinter
BrokenTimeoutSettings
ReconnectSettings
ModemCallbackSettings
ModemCallbackPhoneNumber
ShadowingSettings
TerminalServerProfilePath
TerminalServerHomeDir
TerminalServerHomeDirDrive
The setting 'fTerminalServerRemoteHomeDir' is read-only; it can be queried with GetUserConfiguration but cannot be set with this method.
A call to this method may set all of the settings or any desired subset.
If an error occurs during the processing of this request, the provider will attempt to restore all changed settings to their original values before returning the error.
Arguments
Input Arguments | Required | Description |
---|---|---|
<user> |
Yes |
The user name (SAM account name) for which Terminal Services configuration settings are to be changed. |
<server> |
Yes |
Name of the domain controller or terminal server on which settings are to be changed. If a domain controller is specified, settings for a domain user are changed in Active Directory via the specified DC. If a terminal server is specified, settings for a local user on that server are changed.
Note
In some configurations an error will occur if this parameter is specified as a fully-qualified name. Use the NetBIOS name instead to avoid the issue.
|
<Configuration data> |
No |
The input can include any or all of the following elements:
|
Remarks
Rollback
Yes - the original state of the user's settings is restored on rollback.
Underlying API
WTSSetUserConfig
Sample Code
Example XML Request
<request>
<procedure>
<execute namespace="Terminal Services Provider" procedure="SetUserConfiguration">
<executeData>
<server>PreferredDomainController</server>
<user>UserA</user>
<properties>
<property name="InitialProgram">HelloWorld.exe</property>
<property name="WorkingDirectory">c:\simplePrograms</property>
<property name="fAllowLogonTerminalServer">true</property>
<property name="TimeoutSettingsConnections">0</property>
<property name="TimeoutSettingsDisconnections">0</property>
<property name="TimeoutSettingsIdle">0</property>
<property name="fDeviceClientDrives">false</property>
<property name="fDeviceClientPrinters">false</property>
<property name="fDeviceClientDefaultPrinter">false</property>
<property name="BrokenTimeoutSettings">1</property>
<property name="ReconnectSettings">0</property>
<property name="ModemCallbackSettings">0</property>
<property name="ModemCallbackPhoneNumber"></property>
<property name="ShadowingSettings">0</property>
<property name="TerminalServerProfilePath">\\DC\TSProfiles</property>
<property name="TerminalServerHomeDir">\TSUsers</property>
<property name="TerminalServerHomeDirDrive">c:</property>
<!-- fTerminalServerRemoteHomeDir is read-only and so is not allowed in SetUserConfiguration.
<property name="fTerminalServerRemoteHomeDir">false</property>
-->
</properties>
</executeData>
</execute>
</procedure>
</request>