1

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. 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. Go easy on me, I'm new to 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.

4

1 回答 1

3

You may need to set the HomeDrive property as well:

DirectoryEntry deUser = new DirectoryEntry(findMeinAD(tbPNUID.Text));
deUser.InvokeSet("HomeDirectory", tbPFolderVerification.Text);
deUser.InvokeSet("HomeDrive", "Z:");
deUser.CommitChanges();
于 2008-09-17T20:12:16.447 回答