Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Binding to a User Object with Alternate Credentials

Reply
 
Old 01-23-2009   #1 (permalink)
Bart Perrier


 
 

Binding to a User Object with Alternate Credentials

Is there a way to bind to a user object with alternate credentials? Here is
the line I am using.

' arrADAccounts(intAccountIndex,2) is a 2D
' array that I am using from an ADO recordset
' with the distinguished name in element 2.
Set objUser = GetObject _
("LDAP://" & arrADAccounts(intAccountIndex,2))

' I'd like to do this with alternate credentials
objUser.SetPassword NEW_PASSWORD



My System SpecsSystem Spec
Old 01-23-2009   #2 (permalink)
Richard Mueller [MVP]


 
 

Re: Binding to a User Object with Alternate Credentials


"Bart Perrier" <bart_perrier@xxxxxx> wrote in message
news:uYRPCsafJHA.4728@xxxxxx
Quote:

> Is there a way to bind to a user object with alternate credentials? Here
> is the line I am using.
>
> ' arrADAccounts(intAccountIndex,2) is a 2D
> ' array that I am using from an ADO recordset
> ' with the distinguished name in element 2.
> Set objUser = GetObject _
> ("LDAP://" & arrADAccounts(intAccountIndex,2))
>
> ' I'd like to do this with alternate credentials
> objUser.SetPassword NEW_PASSWORD
>
>
You can use the OpenDSObject method. For example:
=========
Const ADS_SECURE_AUTHENTICATION = &H1

strAdsPath = "LDAP://cn=Test User,ou=West,dc=MyDomain,dc=com"
strUser = "MyDomain\MyUserName"
strPassword = "xYz$312w"

Set objNS = GetObject("LDAP:")
Set objUser = objNS.OpenDSObject(strAdsPath, strUser, strPassword,
ADS_SECURE_AUTHENTICATION)
=========
However, it is not recommended that passwords, especially admin passwords,
be hard coded in a script for security reasons.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Old 01-23-2009   #3 (permalink)
Bart Perrier


 
 

Re: Binding to a User Object with Alternate Credentials


"Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote in
message news:ez$Rh4afJHA.1252@xxxxxx
Quote:

>
> "Bart Perrier" <bart_perrier@xxxxxx> wrote in message
> news:uYRPCsafJHA.4728@xxxxxx
Quote:

>> Is there a way to bind to a user object with alternate credentials? Here
>> is the line I am using.
>>
>> ' arrADAccounts(intAccountIndex,2) is a 2D
>> ' array that I am using from an ADO recordset
>> ' with the distinguished name in element 2.
>> Set objUser = GetObject _
>> ("LDAP://" & arrADAccounts(intAccountIndex,2))
>>
>> ' I'd like to do this with alternate credentials
>> objUser.SetPassword NEW_PASSWORD
>>
>>
>
> You can use the OpenDSObject method. For example:
> =========
> Const ADS_SECURE_AUTHENTICATION = &H1
>
> strAdsPath = "LDAP://cn=Test User,ou=West,dc=MyDomain,dc=com"
> strUser = "MyDomain\MyUserName"
> strPassword = "xYz$312w"
>
> Set objNS = GetObject("LDAP:")
> Set objUser = objNS.OpenDSObject(strAdsPath, strUser, strPassword,
> ADS_SECURE_AUTHENTICATION)
> =========
> However, it is not recommended that passwords, especially admin passwords,
> be hard coded in a script for security reasons.
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>
>
Thanks, Richard.

I do understand the security concern with doing this and I don't like this
alternative, but I do appreciate the reminder.



My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Create an AD Group with Alternate Credentials VB Script
Executing LNK files with alternate credentials PowerShell
executing ps1 from a web browser, alternate credentials PowerShell
running script with alternate credentials PowerShell
PoSh Remote/Alternate Credentials PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46