Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lock an account with VB6: Authentication and security

Status
Not open for further replies.

ramass

Programmer
Jul 10, 2001
19
0
0
FR
I like to lock an account in a VB Script.
I use the
Code:
getObject
functions of VB6 to obtain the account object from a ADSI directory and then, I use the
Code:
IsAccountLocked
property.

Here is my code:
Code:
Set usr = GetObject(&quot;LDAP://<URL>&quot;)
usr.IsAccountLocked = TRUE
usr.SetInfo
Set usr = Nothing

But there can be a problem if the PDC require an authentication. How can I specify the credentials ?

And is it possible to use an algorithm for encryption (SSL...) ?

Thanks in advance
 
HI,

I m using this code for unlocking my user accounts in my doamin.In this program it will ask you username whose account is locked out. just enter the usernmae and release the account.that's it.
This is vb code.Just copy this code in notepad and save it ab *.vbs and try to execute.



UserName = InputBox(&quot;Enter the user's login name that you want to unlock:&quot;)

DomainName = InputBox(&quot;Enter the domain name in which the user account exists:&quot;)


Set UserObj = GetObject(&quot;WinNT://&quot;& DomainName &&quot;/&quot;& UserName &&quot;&quot;)
If UserObj.IsAccountLocked = -1 then UserObj.IsAccountLocked = 0
UserObj.SetInfo

If err.number = 0 Then
Wscript.Echo &quot;The Account Unlock Failed. Check that the account is, in fact, locked-out.&quot;
Else
Wscript.Echo &quot;The Account Unlock was Successful&quot;
End if



This is easier way to administer.
happy.gif
Aslam
 
OK, it works if no authentication is needed.

But my problem is to authenticate against the PDC. If I try your code, I have an
Code:
automation error
when the
Code:
getObject
function is executed.

Matthieu
 
Hi,

If you want to authenticate with another user Then u can use &quot;Su.exe&quot; which comes with resource kit.

Try this out. Aslam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top