VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



ADSI sample showing how to check if a user account is disabled on a computer or domain controller.

by Bart Jonkman (20 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 19th February 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

ADSI sample showing how to check if a user account is disabled on a computer or domain controller.

Rate ADSI sample showing how to check if a user account is disabled on a computer or domain controller.



' This function checks if the user account is disabled
' Requires ADSI

' Check out http://www.activxperts.com/activmonitor for more samples and 
' components


Function IsAccountDisabled( strDomain, strAccount )
    Dim objUser
    Set objUser = GetObject("WinNT://" & strDomain & "/" & strAccount & ",user")
    IsAccountDisabled = objUser.AccountDisabled
End Function 



' Main

Dim strUser, strDomain
Do
   strUsr = inputbox("Please enter the user account name", "Input")
loop until strUsr <> ""

' Request the domain name for this user
do
   strDom = inputbox("Please enter the domain for this account.", "Input")
loop until strDom <> ""


If( IsAccountDisabled( strDom, strUsr ) = True ) Then
    WScript.Echo "Account disabled"
Else
    WScript.Echo "Account enabled"
End If

WScript.Echo( "For more samples, goto http://www.activxperts.com/activmonitor and click" )
WScript.Echo( "on ADSI" )


Download this snippet    Add to My Saved Code

ADSI sample showing how to check if a user account is disabled on a computer or domain controller. Comments

No comments have been posted about ADSI sample showing how to check if a user account is disabled on a computer or domain controller.. Why not be the first to post a comment about ADSI sample showing how to check if a user account is disabled on a computer or domain controller..

Post your comment

Subject:
Message:
0/1000 characters