Check if account is disabled - vbscript
Active Directory Services Interface (ADSI) is a set of COM (Common Object Model) programming Interfaces. Like ODBC, ADSI provides common access to directories by adding a provider for each directory protocol type.
You can use any of the VBScript programs below in ActiveXperts Network Monitor. Click here for an explanation about how to include scripts in ActiveXperts Network Monitor.
On this site, you can find many ADSI samples.
The check-if-account-is-disabled ADSI class can be used in ActiveXperts Network Monitor to monitor your servers.
Example(s)
Function IsAccountDisabled( strDomain, strAccount )
Dim objUser
Set objUser = GetObject("WinNT://" & strDomain & "/" & strAccount & ",user")
IsAccountDisabled = objUser.AccountDisabled
End Function
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
