Option Explicit
' Identify the variables to use.
Dim sUserName, sDomain, oUser, sValue
' Run Help if asked for or if no arguments were provided.
If WScript.Arguments.Count < 1 Then Call Help
If WScript.Arguments(0) = "/?" Then Call Help
' Assign the arguments to variables.
sUserName = WScript.Arguments(0)
sDomain = WScript.Arguments(1)
sValue = WScript.Arguments(2)
' Connect to the user object.
Set oUser = GetObject("WinNT://" & sDomain & "/" & _
sUserName & ",user")
' Set the value of AccountDisabled, write the information, and report.
oUser.AccountDisabled = sValue
oUser.SetInfo
WScript.Echo "The operation is complete."
Sub Help
WScript.Echo "disableuser username domainname true/false"
WScript.Echo "This script enables and disables user accounts."
WScript.Echo "The first argument is the user name."
WScript.Echo "The second argument is the domain name."
WScript.Echo "The third argument is the value of AccountDisabled."
WScript.Echo "Separate the arguments with a single space."
WScript.Echo "To disable the account, type True."
WScript.Echo "To enable, type False."
WScript.Quit
End Sub