This topic has not yet been rated - Rate this topic

IADsTSUserEx::TerminalServicesProfilePath property

Applies to: desktop apps only

The roaming or mandatory profile path to be used when the user logs on to the Remote Desktop Session Host (RD Session Host) server.

This property is read/write.

Syntax

HRESULT put_TerminalServicesProfilePath(
  [in]   BSTR pNewVal
);

HRESULT get_TerminalServicesProfilePath(
  [out]  BSTR *pVal
);

Property value

The roaming or mandatory profile path.

Error codes

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

Remarks

The profile path is in the following network path format:

\\ServerName\ProfilesFolderName\UserName

Note  A Remote Desktop Services profile path is used only for logging on to an RD Session Host server.

Examples

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


 IADsContainer *pContainer = NULL;
 IDispatch *pNewObject = NULL;
 IADsTSUserEx *pTSUser = NULL;
 IADsUser *pUser = NULL;
 HRESULT hr = ERROR_SUCCESS;

 CoInitialize(NULL);
 //
 // Bind to the known container.
 //
 hr = ADsGetObject(
    L"LDAP://DOMAIN/CN=Users,DC=Server1,DC=Domain,DC=com",
    IID_IADsContainer,
    (void**)&pContainer);

 if( !SUCCEEDED(hr)) {
  wprintf(L"ADsGetObject ret failed with 0x%x\n", hr);
  return FALSE;
 }
 //
 // Create the new Active Directory Service Interfaces User object.
 //
 hr = pContainer->Create(L"user",
                         L"cn=test3",
                         &pNewObject);
 pContainer->Release();

 if( !SUCCEEDED(hr)) {
  wprintf(L"Create ret failed with 0x%x\n", hr);
  return FALSE;
 }
 //
 // Get the IADsTSUser interface from the user object.
 //
 hr = pNewObject->QueryInterface(IID_IADsTSUserEx, (void**)&pTSUser);

 if( !SUCCEEDED(hr)) { 
  wprintf(L"QueryInterface for IADsTSUserEx failed with ret 0x%x\n",
          hr);
  return FALSE;
 }
 //
 // Get the IADsTSUser interface from the user object.
 //
 hr = pNewObject->QueryInterface(IID_IADsUser, (void**)&pUser);

 if( !SUCCEEDED(hr)) {
  wprintf(L"QueryInterface for IAsUser failed with 0x%x\n", hr);
  return FALSE;
 }
 pNewObject->Release();

 //
 // Set TerminalServicesProfilePath
 //
 pTSUser->put_TerminalServicesProfilePath(L"c:\\windows");
 pTSUser->Release();

 //
 // Commit the object data to the directory.
 //
 pUser->SetInfo();
 pUser->Release();
 CoUninitialize();


You can use the following script examples to bind to a provider's namespace. Two examples bind with supplied credentials; two bind without credentials.

The first example shows a script that binds to the Security Accounts Manager (SAM) database with the supplied credentials.

The second example shows a script that binds to the Active Directory database with the supplied credentials.

Set DSO = GetObject("WinNT:")
Set usr = DSO.OpenDSObject(
    "WinNT://Server1/Test,user",
    Domain\User,
    Password,
    ADS_SECURE_AUTHENTICATION)
Wscript.echo usr.TerminalServicesProfilePath
usr.TerminalServicesProfilePath = "profile path"
usr.SetInfo
WScript.echo usr.TerminalServicesProfilePath

Set DSO = GetObject("LDAP:")
Set usr = DSO.OpenDSObject(
    "LDAP://DOMAIN/CN=Test,CN=Users,DC=Server1,DC=Domain,DC=com",
    Domain\User,
    Password,
    ADS_SECURE_AUTHENTICATION)
Wscript.echo usr.TerminalServicesProfilePath
usr.TerminalServicesProfilePath = "profile path"
usr.SetInfo
WScript.echo usr.TerminalServicesProfilePath

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server

Header

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

Type library

Tsuserex.tlb

DLL

Tsuserex.dll

See also

IADsTSUserEx

 

 

Send comments about this topic to Microsoft

Build date: 3/7/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ