简体   繁体   English

尝试使用C#在AD中更新用户的“连接到:”主目录路径

[英]Attempting to update a user's “connect to:” home directory path in AD using C#

I have a small application I am working on that at one point needs to update a user's home directory path in AD under the profile tab where it allows you to map a drive letter to a particular path. 我有一个正在处理的小应用程序,有一点需要在配置文件选项卡下的AD中更新用户的主目录路径,在该选项卡中您可以将驱动器号映射到特定路径。 The code I have put together so far sets the Home Folder Local path portion OK, but I'm trying to figure out the name for the "connect" portion, as well as how to select the drive letter. 到目前为止,我编写的代码将主文件夹本地路径部分设置为OK,但是我试图找出“连接”部分的名称以及如何选择驱动器号。 Go easy on me, I'm new to C#. 放轻松吧,我是C#的新手。 Thanks!! 谢谢!!

Here's my code that updates the Local path section. 这是我的代码,用于更新“本地路径”部分。

        DirectoryEntry deUser = new
                DirectoryEntry(findMeinAD(tbPNUID.Text));
                deUser.InvokeSet("HomeDirectory", tbPFolderVerification.Text);
                deUser.CommitChanges();

Where findMeinAD is a method that looks up a user's info in AD and tbPFolderVerification.Text is a text box in the form that contains the path I'd like to set a particular drive to map to. findMeinAD是在AD中查找用户信息的方法,而tbPFolderVerification.Text是形式为文本框的文本框,其中包含我要设置要映射的特定驱动器的路径。

You may need to set the HomeDrive property as well: 您可能还需要设置HomeDrive属性:

DirectoryEntry deUser = new DirectoryEntry(findMeinAD(tbPNUID.Text));
deUser.InvokeSet("HomeDirectory", tbPFolderVerification.Text);
deUser.InvokeSet("HomeDrive", "Z:");
deUser.CommitChanges();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM