Re: ADO with alternate credentials

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I was able to use the format below as long as the system is joined to the AD
domain I'm querying. It still will not work if the system is not joined to
the domain. It appears that AD will not answer to an 'anonymous' system even
with valid credentials. I tried turning of 'encrypt password' but still no
go.

Steve

Set objADOConnection = CreateObject("ADODB.Connection")
objADOConnection.Provider = "ADsDSOObject"
objADOConnection.Properties("User ID") = txtUserID
objADOConnection.Properties("Password") = txtPassword
objADOConnection.Properties("Encrypt Password") = True
objADOConnection.Open "DS Query", txtUserID, txtPassword


"/\\/\\o\\/\\/" wrote:

> you can set the username and password on an ADO connection like this :
>
> objADOConnection.name = "usr"
> objADOConnection.Password = "psw"
>
> I can not test if it works with the ADsDSOObject provider,
> till friday.
>
> hope this helps.
>
> gr /\/\o\/\/
>
> 3
>
> Steve wrote:
> > I'm trying to use ADO to enumerate the OU's in AD using another
> > userid/password. A pice of the script is below. ANyone know how to use a
> > different userid?
> >
> > Thanks,
> > Steve
> >
> > 'parse domain name and set command vars
> > strADsPath = "dc=" & Replace(txtDomain, ".", ";dc=")
> > strBase = "<LDAP://"; & strADsPath & ">"
> > strFilter = "(objectCategory=ORGANIZATIONALUNIT)"
> > strAttributes = "ou,distinguishedName"
> > strScope = "subtree"
> >
> > ' Create ADO connection and command
> > Set objADOConnection = CreateObject("ADODB.Connection")
> > objADOConnection.Open "Provider=ADsDSOObject;"
> > Set objADOCommand = CreateObject("ADODB.Command")
> > objADOCommand.ActiveConnection = objADOConnection
> >
> > ' Create the command string using the four parts
> > objADOCommand.CommandText = strBase & ";" & strFilter & ";" & strAttributes
> > & ";" & strScope
> >
> > ' Set the properties of the recordset
> > objADOCommand.Properties("Page Size") = 2000
> > objADOCommand.Properties("Size Limit") = 20000
> >
> > ' Execute the query for the user in the directory
> > Set objADORecordset = objADOCommand.Execute
> >
> >
>
.



Relevant Pages

  • Re: User Rights Assignment - not available - Resolved
    ... Thanks Steve for your effort to help me here. ... If none of that works I would try an upgrade/repair install ... it shows user rights and use the Resource Kit command line tool ... This operation may find that this database is corrupt ...
    (microsoft.public.windowsxp.security_admin)
  • Re: how i will open (from Java Application) the MS word format /html documentsin repective Applicati
    ... Thanx Steve for the nice explanation.i'll use this concept in my ... The specific method depends on the presence of a "file manager" type ... I create a URI object around it and use that. ... array by separating the CDE command line at the spaces, ...
    (comp.lang.java.programmer)
  • Re: Creating history record
    ... The reason I need to wait until they hit the save command is that they have ... an undo key if can they change their minds during the update. ... No update, no history. ... "Steve Schapel" wrote: ...
    (microsoft.public.access.macros)
  • Re: Does anyone know exactly what the repair function does?
    ... is there a command line version that can be used inside a ... >I ran into a wierd problem on a tricky navy network, and in order to keep my ... >lan connection up, I am forced to monitor it constantly and press the ... Steve Winograd, MS-MVP ...
    (microsoft.public.windowsxp.network_web)
  • ADODB.Connection Open Command appears to hang
    ... I am using some script in Excel to open an ADO connection. ... I am attempting to connect to ORACLE database using ADO connection. ... I've placed log messages into a text file and pinpointed the command causing ...
    (microsoft.public.data.ado)