JSI Tip 9680. How can a script return user properties using the WinNT provider?

Jerold Schulman

August 28, 2005

4 Min Read
ITPro Today logo in a gray background | ITPro Today


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

   Optional

   Optional

   Optional

FileService

HostComputer

DisplayName

Version

ServiceType

StartType

Path

ErrorControl

LoadOrderGroup

Description

MaxUserCount

ServiceAccountName

Dependencies

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

FileShare

CurrentUserCount

Description

HostComputer

Path

MaxUserCount

   Optional

   Optional

   Optional

   Mandatory

   Mandatory

FPNWFileService

HostComputer

DisplayName

Version

ServiceType

StartType

Path

ErrorControl

LoadOrderGroup

ServiceAccountName

Dependencies

Description

MaxUserCount

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

FPNWFileShare

CurrentUserCount

HostComputer

Path

MaxUserCount

   Optional

   Optional

   Mandatory

   Mandatory

FPNWResource

User

Path

LockCount

   Optional

   Optional

   Optional

FPNWSession

User

Computer

ConnectTime

   Optional

   Optional

   Optional

Group

Description

objectSid

   Optional

   Optional

Namespace

IADs (all methods and properties.)

PrintJob

HostPrintQueue

User

TimeSubmitted

TotalPages

Size

Description

Priority

StartTime

UntilTime

Notify

TimeElapsed

PagesPrinted

Position

Action

ObjectGUID

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

PrintQueue

PrinterPath

PrinterName

Model

Datatype

PrintProcessor

PrintDevices

Description

HostComputer

Location

StartTime

UntilTime

DefaultJobPriority

JobCount

Priority

Attributes

BannerPage

ObjectGuid

Action

   Mandatory

   Mandatory

   Mandatory

   Mandatory

   Mandatory

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

Resource

User

Path

LockCount

   Optional

   Optional

   Optional

Service

HostComputer

LoadOrderGroup

ServiceAccountName

Dependencies

StartType

ServiceType

DisplayName

Path

ErrorControl

   Optional

   Optional

   Optional

   Optional

   Mandatory

   Mandatory

   Mandatory

   Mandatory

   Mandatory

Session

Computer

ConnectTime

IdleTime

User

   Optional

   Optional

   Optional

   Optional

User

AccountExpirationDate

AutoUnlockInterval

BadPasswordAttempts

Description

FullName

HomeDirectory

UserFlags

LockoutObservationInterval

LoginHours

LastLogin

LastLogoff

LoginScript

LoginWorkstations

MinPasswordAge

MinPasswordLength

MaxBadPasswordsAllowed

MaxLogins

MaxPasswordAge

MaxStorage

ObjectSid

Parameters

PasswordAge

PasswordExpirationDate

PasswordExpired

PasswordHistoryLength

PrimaryGroupID

Profile

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional

   Optional



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like