active directory update with application.

I want to be able to update attributes of active directory users.

I am using this code to get the user's information. Specifically if the user is active or disabled.

Dim searchAs DirectorySearcher =New DirectorySearcher
search.Filter =
String.Format("(SAMAccountName={0})", userName)
search.PropertiesToLoad.Add("givenName")
search.PropertiesToLoad.Add("sn")
search.PropertiesToLoad.Add("userAccountControl")
Dim groupsListAs StringBuilder =New StringBuilder
Dim resultAs SearchResult = search.FindOne
OnErrorGoTo ErrorHandler
sFirstName = result.Properties("givenName").Item(0)
sLastName = result.Properties("sn").Item(0)

If (result.Properties("userAccountControl").Item(0) = 66050)Then
bDisabled =True
Else : bDisabled =False
EndIf

ExitSub

--

How can I get that user again and modify the "userAccountControl" item value to something else and comit the changes.

Any and all help will be greatly apprecited.
Thanks

[2250 byte] By [ny3ranger] at [2008-2-10]
# 1

Hi,

This thread is devoted to questions related to the System.Net namespace in the .Net Framework. As such, this forum is monitored by the System.Net team. In order to get your question answered in a timely manner, I suggest reposting this to another forum or newsgroup that is devoted to Active Directory. As a starting point, you may want to investigate the Active Directory newsgroups located here:

microsoft.public.active.directory.interfaces
microsoft.public.cn.windows.server.active_directory
microsoft.public.exchange2000.active.directory.integration
microsoft.public.platformsdk.active_directory
microsoft.public.win2000.active_directory
microsoft.public.windows.server.active_directory

MikeFlasko at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Framework Networking and Communication...
# 2
How do you get to those places?
mattdawg at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Framework Networking and Communication...

.NET Development

Site Classified