by Anonymous (267 Submissions)
Category: Windows System Services
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Sun 4th May 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
ADSI sample - checks if the user account is disabled. Written in VBScript, using ADSI.
' This function checks if the user account is disabled
' Requires ADSI
' Check out http://www.activexperts.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.activexperts.com/activmonitor and click" )
WScript.Echo( "on ADSI" )
No comments have been posted about ADSI sample - checks if the user account is disabled. Written in VBScript, using ADSI.. Why not be the first to post a comment about ADSI sample - checks if the user account is disabled. Written in VBScript, using ADSI..