I need to know how to make a change in a field and comit it back into active
directory. This is code that I am using. I def NEED to have the
userPrincipalName to get the current logon user in the query, and change just
his profile path. Any ideas???

Thanks

'-----------------------------------------------------------------

Option Explicit

Const ADS_SCOPE_SUBTREE = 2



'these next 4 strings aren't very necessary but it makes it look cleaner
'towards the end
Dim strName
Dim strProfile
Dim strHomeDrive
Dim strHomeDirectory
Dim strDistinguishedName
Dim strlogon
'strprofile will error on a null value so I am

Dim rs
Dim cnn
Dim cmd
Dim objuser
Set cnn = CreateObject("ADODB.Connection")
Set cmd = CreateObject("ADODB.Command")
' Open the connection.
cnn.Provider = "ADsDSOObject" ' This is the ADSI OLE-DB provider name
cnn.Open "Active Directory Provider"
' Create a command object for this connection.
Set cmd.ActiveConnection = cnn

' Compose a search string and replace DC=YourDomain, DC=COM
cmd.CommandText = "select name, distinguishedname, profilepath, homedrive,
homedirectory, userPrincipalName" _
& " from 'LDAP:// OU= NY, DC=FFHSJ, DC=COM' WHERE objectCategory='user' And
objectCategory='person' and userPrincipalName='wahidta@ffhsj.com'"
cmd.Properties("Page Size") = 1000
cmd.Properties("Timeout") = 30
cmd.Properties("Searchscope") = ADS_SCOPE_SUBTREE 'search all containers
cmd.Properties("Cache Results") = False

Set rs = cmd.Execute

'------------------------------------------------------------------------------

Re: vbscript comit changes to active directory by Torgeir

Torgeir
Fri Mar 11 13:42:23 CST 2005

Hi,

Please see response to your other post "vbscript help"...


--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx