directoryservices

How do I determine the ASP.NET version of a virtual directory or website using C#?

强颜欢笑 提交于 2019-12-01 10:38:17
问题 How do I find out the .NET framework of an IIS virtual directory is using in C#. I need to display it to the user. using System.DirectoryServices; using System.IO; private enum IISVersion { IIS5, IIS6 } private void ReadVirtualDirectory(string server, string directory, IISVersion version) { string siteID = string.Empty; string path = string.Empty; switch(verison) { case IISVersion.IIS5: path = string.Format("IIS://{0}/W3SVC/1/Root", server); if(!string.IsNullOrEmpty(directory)) { path =

Managing terminal users through System.DirectoryServices

自古美人都是妖i 提交于 2019-12-01 10:38:01
问题 I have a environment where I need to frequently change the parameters to a program that is launched when a user logs in to the terminal server. As of right now we open the computer management snap-in and edit the environment tab for the user and change the parameters by hand under "Start the following program at logon:". I would like to automate the process. I have been looking in to System.DirectoryServices and System.DirectoryServices.AccountManagement and reading all I can about it. So far

What's the connection string for LDAP?

南笙酒味 提交于 2019-12-01 10:14:40
问题 Here how I need to use it: string tmpDirectory = String.Format("LDAP://ou={0},dc={1},dc={2}", parentOrganizationUnit, domainName, domainExtension ); When I try to run some code using this connection, I get an exception. (See this question for more information). I've been told I need to provide the connection string with credentials - a username and a password. What's the connection string like? I need the exact syntax. :) Thanks! I'm using Windows Server 2003 and Active Directory. 回答1: The

Improving performance of System.DirectoryServices.AccountManagement

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 08:02:52
I have a program that will let me manage users on our terminal server that we use to demo our software. I have been trying to improve the performace of adding users to the system (It adds the main account then it adds sub accounts if needed, for example if I had a user of Demo1 and 3 sub users it would create Demo1, Demo1a, Demo1b, and Demo1c.) private void AddUsers(UserInfo userInfo, InfinityInfo infinityInfo, int subUserStart) { using (GroupPrincipal r = GroupPrincipal.FindByIdentity(context, "Remote Desktop Users")) using (GroupPrincipal u = GroupPrincipal.FindByIdentity(context, "Users"))

Change Password of a local windows user

 ̄綄美尐妖づ 提交于 2019-12-01 07:32:32
Usually it is possible to change it´s own password in Windows, without having admin-rights . I'm writing a tool to manage users and Groups on several servers/clients. I also want to give a client the right to edit his own password. The clients don't have admin-rights of course. To change a users password having admin rights I used DirectoryEntry like this: try { DirectoryEntry localDirectory = new DirectoryEntry("WinNT://" + Environment.MachineName.ToString()); DirectoryEntries users = localDirectory.Children; DirectoryEntry user = users.Find(username); user.Invoke("SetPassword", newPassword);

System.DirectoryServices is slow?

风格不统一 提交于 2019-12-01 06:25:23
I'm using the code below to look up information in active directory when a user logs on to a website. Running against a local domain it's very quick, but running over a VPN to a remote trusted domain, it's very slow (takes around 7 or 8 seconds). Running dsa.msc from the same box to the remote domain is almost as quick as running it locally. I'm using property filtering to retrieve the minimum amount of data possible, so is there something inherently slow about System.DirectoryServices in this scenario, or does anyone have any hints on how to improve the performance? The network connection

Improving performance of System.DirectoryServices.AccountManagement

主宰稳场 提交于 2019-12-01 06:14:46
问题 I have a program that will let me manage users on our terminal server that we use to demo our software. I have been trying to improve the performace of adding users to the system (It adds the main account then it adds sub accounts if needed, for example if I had a user of Demo1 and 3 sub users it would create Demo1, Demo1a, Demo1b, and Demo1c.) private void AddUsers(UserInfo userInfo, InfinityInfo infinityInfo, int subUserStart) { using (GroupPrincipal r = GroupPrincipal.FindByIdentity

System.DirectoryServices is slow?

狂风中的少年 提交于 2019-12-01 05:58:51
问题 I'm using the code below to look up information in active directory when a user logs on to a website. Running against a local domain it's very quick, but running over a VPN to a remote trusted domain, it's very slow (takes around 7 or 8 seconds). Running dsa.msc from the same box to the remote domain is almost as quick as running it locally. I'm using property filtering to retrieve the minimum amount of data possible, so is there something inherently slow about System.DirectoryServices in

DirectorySearcher FindOne() delay on initial execution

柔情痞子 提交于 2019-12-01 04:41:41
I'm seeing an initial delay of 2-5 seconds between the time that I execute DirectorySearcher FindOne() and the first network packet I see go out to the LDAP server. After the initial execution, subsequent executions complete instantly for about 45 seconds. After that period of fast executions, the next execution will be delayed and again all subsequent executions will complete instantly. It seems like there's some sort of caching going on but I haven't been able to find any resources confirming that or describing what is causing the initial delay. We noticed this on a client Windows 2008

Change Password of a local windows user

百般思念 提交于 2019-12-01 04:29:05
问题 Usually it is possible to change it´s own password in Windows, without having admin-rights . I'm writing a tool to manage users and Groups on several servers/clients. I also want to give a client the right to edit his own password. The clients don't have admin-rights of course. To change a users password having admin rights I used DirectoryEntry like this: try { DirectoryEntry localDirectory = new DirectoryEntry("WinNT://" + Environment.MachineName.ToString()); DirectoryEntries users =