Condividi tramite


Metodo IADsTSUserEx::p ut_TerminalServicesProfilePath (tsuserex.h)

Percorso del profilo mobile o obbligatorio da usare quando l'utente accede al server Host sessione Desktop remoto (Host sessione Desktop remoto).

Si tratta di una proprietà di lettura/scrittura.

Sintassi

HRESULT put_TerminalServicesProfilePath(
  BSTR pNewVal
);

Parametri

pNewVal

Valore restituito

nessuno

Osservazioni

Il percorso del profilo è nel formato di percorso di rete seguente:

\\Nomeserver\ProfilesFolderName\Nome utente

Nota Un percorso del profilo di Servizi Desktop remoto viene usato solo per l'accesso a un server Host sessione Desktop remoto.
 

Esempio

L'esempio seguente mostra un programma che esegue l'associazione al database di Active Directory senza credenziali.

 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();

È possibile usare gli esempi di script seguenti per eseguire il binding allo spazio dei nomi di un provider. Due esempi si associano con le credenziali fornite; due binding senza credenziali.

Il primo esempio mostra uno script che esegue l'associazione al database sam (Security Accounts Manager) con le credenziali fornite.

Il secondo esempio mostra uno script che esegue l'associazione al database di Active Directory con le credenziali fornite.

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

Requisiti

Requisito Valore
Client minimo supportato Windows Vista
Server minimo supportato Windows Server 2008
Piattaforma di destinazione Windows
Intestazione tsuserex.h (include Tsuserex.h, Tsuserex_i.c)
DLL Tsuserex.dll

Vedi anche

IADsTSUserEx