Export (0) Print
Expand All
Expand Minimize

WTSSetUserConfig function

Modifies configuration information for the specified user on the specified domain controller or Remote Desktop Session Host (RD Session Host) server.

Syntax


BOOL WTSSetUserConfig(
  _In_  LPTSTR pServerName,
  _In_  LPTSTR pUserName,
  _In_  WTS_CONFIG_CLASS WTSConfigClass,
  _In_  LPTSTR pBuffer,
  _In_  DWORD DataLength
);

Parameters

pServerName [in]

Pointer to a null-terminated string containing the name of a domain controller or RD Session Host server. Specify WTS_CURRENT_SERVER_NAME to indicate the RD Session Host server on which your application is running.

pUserName [in]

Pointer to a null-terminated string containing the name of the user whose configuration is being set.

WTSConfigClass [in]

Specifies the type of information to set for the user. This parameter can be one of the values from the WTS_CONFIG_CLASS enumeration type. The documentation for WTS_CONFIG_CLASS describes the format of the data specified in ppBuffer for each of the information types.

pBuffer [in]

Pointer to the data used to modify the specified user's configuration.

DataLength [in]

Size, in TCHARs, of the pBuffer buffer.

Return value

If the function succeeds, the return value is a nonzero value.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The WTSQueryUserConfig and WTSSetUserConfig functions are passed a server name instead of a handle because user account information often resides on a domain controller. To set user configuration information, use the primary domain controller. You can call the NetGetDCName function to get the name of the primary domain controller. To query user configuration information, you can use the NetGetAnyDCName function to get the name of a primary or backup domain controller.

Any domain controller can set or query user configuration information. Use the DsGetDcName function to retrieve the name of a domain controller.

If the value of the WTSConfigClass parameter corresponds to an integer value in the WTS_CONFIG_CLASS enumeration, define the value to be set as a DWORD. Then cast the value to an LPWSTR in the call to WTSSetUserConfig, as in the following example:

WTSSetUserConfig(strServer.GetBuffer(0), m_strName.GetBuffer(0), WTSUserConfigfAllowLogonTerminalServer, (LPWSTR) &dwEnable, sizeof(DWORD));

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2003

Header

Wtsapi32.h

Library

Wtsapi32.lib

DLL

Wtsapi32.dll

Unicode and ANSI names

WTSSetUserConfigW (Unicode) and WTSSetUserConfigA (ANSI)

See also

WTS_CONFIG_CLASS
WTSQueryUserConfig

 

 

Show:
© 2014 Microsoft