2013-06-20 149 views
1

我想使用VB.NET在Active Directory中添加用戶配置文件配置文件路徑信息DirectoryServices.AccountManagement但似乎無法做到這一點。我可以添加我需要的所有其他字段,包括與配置文件路徑位於同一選項卡中的登錄腳本。DirectoryServices.AccountManagement用戶配置文件配置文件路徑

我一直在尋找UserPrincipal at MS,但我無法看到與配置文件路徑相關的任何內容。

相關代碼:

Dim ctx As New PrincipalContext(ContextType.Domain, "sometext", "OU=Domain Objects,DC=sometext,DC=local") 

    Dim user As New UserPrincipal(ctx, "NewUser", "[email protected]", True) 

    user.GivenName = "GivenName" 
    user.Surname = "Surname" 
    user.HomeDirectory = "\\MyHomeDirectory\" 
    user.HomeDrive = "Z:" 

    user.ExpirePasswordNow() 

    user.Save() 

回答

1

這是一個有點當天晚些時候,但以防萬一別人看。

由於某種原因,UserPrincipal類沒有此屬性。在保存UserPrincipal後,您可以獲得底層目錄條目

DirectoryEntry entry = (DirectoryEntry)user.GetUnderlyingObject(); 
entry.Properties["profilePath"].Value = "somepath"; 
entry.CommitChanges(); 
相關問題