JSI Tip 9680. How can a script return user properties using the WinNT provider?
August 28, 2005
UserProp.vbs is a sample script that will return some user properties in a CSV format.
The syntax for using the UserProp.vbs script is:
CScript.exe //nologo UserProp.vbs
Examples:
cscript //nologo c:utilUserProp.vbs JSIINC/Jerrycscript //nologo c:utilUserProp.vbs "JSIINC/Jennifer"cscript //nologo c:utilUserProp.vbs JSI009/Administrator
NOTE: See How can a script return user properties using the LDAP provider?
UserProp.vbs contains:
Dim objArguments, strDomainUserSet objArguments = Wscript.ArgumentsIf WScript.Arguments.Count = 0 then Wscript.QuitstrDomainUser=objArguments(0)On Error Resume Next Set objUser = GetObject("WinNT://" & strDomainUser ) Wscript.Echo
" & strDomainUser &
,
_ & objUser.LastLogin &
,
_ & objUser.AutoUnlockInterval &
,
_ & objUser.BadPasswordAttempts &
,
_ & objUser.Description &
,
_ & objUser.FullName &
,
_ & objUser.HomeDirectory &
,
_ & objUser.UserFlags &
,
_ & objUser.LockoutObservationInterval &
,
_ & objUser.LoginScript &
,
_ & objUser.MinPasswordAge &
,
_ & objUser.MinPasswordLength &
,
_ & objUser.MaxBadPasswordsAllowed &
,
_ & objUser.MaxPasswordAge &
,
_ & objUser.MaxStorage &
,
_ & objUser.PasswordAge &
,
_ & objUser.PasswordExpirationDate &
,
_ & objUser.PasswordExpired &
,
_ & objUser.PasswordHistoryLength &
,
_ & objUser.PrimaryGroupID &
,
_ & objUser.Profile &
"Wscript.Quit
WinNT Schema's Mandatory and Optional Properties
The following table lists the supported object properties (that is, the related ADSI interface property methods) in the WinNT provider. A property can be optional or mandatory.
Object Class
Computer | Division Owner OperatingSystem OperatingSystemVersion Processor ProcessorCount | Optional Optional Optional Optional Optional Optional |
---|---|---|
Domain | MinPasswordLength MinPasswordAge MaxPasswordAge MaxBadPasswordsAllowed PasswordHistoryLength AutoUnlockInterval LockoutObservationInterval | Optional Optional Optional Optional |