active-directory

List all UPN Suffixes from Active Directory

此生再无相见时 提交于 2020-01-06 07:28:10
问题 I'm trying to get a list of all upnsuffixes from AD using C#. I tried this with no success public static List<string> GetuPNSuffixes() { DirectoryEntry partitions = new DirectoryEntry("LDAP://xxxxx.com/CN=Partitions,CN=Configuration,DC=xxxxx,DC=com", "user", "pass"); DirectorySearcher searcher = new DirectorySearcher(partitions); searcher.PropertiesToLoad.Add("uPNSuffixes"); List<string> suffixes = new List<string>(); foreach (SearchResult sr in searcher.FindAll()) { foreach (string pn in sr

Tomcat + LDAP issue: socket closed on connection

瘦欲@ 提交于 2020-01-06 07:08:07
问题 I'm trying to configure Tomcat to connect to an LDAP server on our network, and I'm getting the following error: javax.naming.ServiceUnavailableException: xx.xx.xx.xx:636; socket closed at com.sun.jndi.ldap.Connection.readReply(Connection.java:419) at com.sun.jndi.ldap.LdapClient.ldapBind(LdapClient.java:340) at com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:192) at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2694) Here is the attempted Realm: <Realm className="org.apache

Use .Net DirectoryServices to Set TTL on Active Directory Group Membership

妖精的绣舞 提交于 2020-01-06 06:48:27
问题 I am using the tools in the .Net System.DirectoryServices.AccountManagement namespace to manage Active Directory groups - group creation, adding users to groups, removing users from group, etc. Here's some code that shows what I'm doing right now... -- group creation // connect to our organizational unit on the production Active Directory Server using (PrincipalContext principalCtx = new PrincipalContext(ContextType.Domain, s_prodAdServerName, s_ouPath)) { // create group with necessary

How to deep into the LDAP tree to find a user who can authenticate in spring ldap security

社会主义新天地 提交于 2020-01-06 06:27:40
问题 I want to use spring security ldap authentication. However I would like to traverse ldap tree recursively. Unfortunately I can find a user only one level or depth. For example , my user tree likes below: ouUsers: has users (user1, user2 etc) and subtrees (ouGenel, ouYatay). And subtrees have subtrees and users. I would like to traverse the ldap tree recursively to authenticate in spring security project. My spring authencation code is below, what should I change in my code? : @Override public

How to deep into the LDAP tree to find a user who can authenticate in spring ldap security

我怕爱的太早我们不能终老 提交于 2020-01-06 06:27:12
问题 I want to use spring security ldap authentication. However I would like to traverse ldap tree recursively. Unfortunately I can find a user only one level or depth. For example , my user tree likes below: ouUsers: has users (user1, user2 etc) and subtrees (ouGenel, ouYatay). And subtrees have subtrees and users. I would like to traverse the ldap tree recursively to authenticate in spring security project. My spring authencation code is below, what should I change in my code? : @Override public

Modifying PowerShell to display phone number in International format without changing the AD Attributes?

只愿长相守 提交于 2020-01-06 06:01:33
问题 I need to modify the below code with some International Phone area code formatting from the Active Directory without modifying the actual AD attribute value: $defaultTelephone = '1800 552 001' #Get Active Directory information for the currently logged on user $sysInfo = New-Object -ComObject 'ADSystemInfo' $userDN = $sysInfo.GetType().InvokeMember('UserName', 'GetProperty', $null, $sysInfo, $null) $adUser = [ADSI]"LDAP://$($userDN)" [void][Runtime.InteropServices.Marshal]:

Notify me when events in Active Directory occur in C#

时间秒杀一切 提交于 2020-01-06 03:49:05
问题 I need to get notification when certain events occur in Active Directory using LDAP protocol. Events that should be triggered are: When a certain AD group is associated to a user. And if a field (like phone number) has changed in AD user. I searched all internet but mostly solutions are based on the code on the end of this article: Registering change notification with Active Directory using C# As mentioned in that article there are 3 ways to do it: Using USNChanged Using the DirSync Control

Modify attributes in AD via PowerShell (no Quest)

好久不见. 提交于 2020-01-06 03:42:13
问题 Say I have users and their physicalDeliveryOfficeName attribute, called Office in AD is set to New York, and others say Chicago. I want to setup a script that will loop through all users. If physicalDeliveryOfficeName = Chicago Set address properties Street: 8888 Chicago Lane City: Chicago State: IL Zip: 60066 Country: United States else if physicalDeliveryOfficeName = New York Set address properties Street: 9999 New York Lane City: New York State: NY Zip: 11111 Country: United States I can't

How to validate the credentials passed to a `PrincipalContext`

筅森魡賤 提交于 2020-01-06 02:33:27
问题 This is a follow up to my previous question. Question What is the correct way of validating the credentials passed to a PrincipalContext ? Background In my application I instantiate a PrincipalContext using PrincipalContext(ContextType, String, String, String). I have a number of integration tests that fail when the credentials are incorrect (or the supplied credentials are not for an admin) so I want to be able to catch this. If the credentials are invalid PrincipalContext.ConnectedServer

How can I set the values on the Environment tab using New-ADUser with PowerShell?

China☆狼群 提交于 2020-01-05 23:21:09
问题 I am using a PowerShell script to add users from a CSV file, but I have been unable to find a way to set the values on the Environment tab. I have tried using -OtherAttributes @{'msTSInitialProgram'="programToRun"; 'msTSWorkDirectory'="directoryToRunIn"} to no avail. I am using Server 2008 R2. Here is the tab I am talking about: How can I set these values? 回答1: If anyone else is interested: $dn = (Get-ADUser $user).DistinguishedName $ext = [ADSI]"LDAP://$dn" $ext.PSBase.InvokeSet(