User name Administrator
Full Name
Comment Built-in account for administering the
computer/domain
User's comment
Country code 000 (System Default)
Account active Yes
Account expires Never
Password last set 12/6/2007 9:27 AM
Password expires Never
Password changeable 12/6/2007 9:27 AM
Password required Yes
User may change password Yes
Workstations allowed All
Logon script
User profile
Home directory
Last logon 12/5/2007 9:13 AM
Logon hours allowed All
Thanks,
Aaron K
On Error Resume Next
Dim objNetwork
Set objNetwork=CreateObject("WScript.Network")
strTitle="ADSI Schema Browse"
strPrompt="Enter an ADSI path:"
strDefault="WinNT://" & objNetwork.ComputerName
strADSPath=InputBox(strPrompt,strTitle,strDefault)
If strADSPath="" Then WScript.Quit
Set objVar=GetObject(strADSPath)
If IsObject(objVar) Then
strHeader="General Object properties for " & objVar.Name
wscript.echo strHeader
WScript.Echo String(Len(strHeader),"-")
Set objClass = GetObject(objVar.Schema)
Wscript.Echo "Class: " & objClass.Name
Wscript.Echo "GUID: " & objClass.GUID
Wscript.Echo "Implemented by: " & objClass.CLSID
WScript.Echo VbCrLf
strMandatoryHeader="Mandatory Properties in this Class (" &_
UBound(objClass.MandatoryProperties)+1 & "): "
Wscript.Echo strMandatoryHeader
WScript.Echo String(Len(strMandatoryHeader),"-")
For Each objProperty In objClass.MandatoryProperties
Wscript.Echo " " & objProperty & " : " &_
GetValue(objVar,objProperty)
Next
WScript.Echo VbCrLf
strOptionalHeader="Optional Properties in this Class (" &_
UBound(objClass.OptionalProperties)+1 & "): "
Wscript.Echo strOptionalHeader
WScript.Echo String(Len(strOptionalHeader),"-")
For Each objProperty In objClass.OptionalProperties
Wscript.Echo " " & objProperty & " : " &_
GetValue(objVar,objProperty)
Next
Else
WScript.Echo "Failed to get " & strADSPath
End if
wscript.quit
Function GetValue(objItem,strProperty)
On Error Resume Next
Dim objProperty
objProperty=objItem.Get(strProperty)
If TypeName(objProperty)<>"Empty" Then
If IsArray(objProperty) Then
if TypeName(objProperty)="Byte()" Then
strProp="Byte array"
Else
wscript.echo "!!" & strProperty & " is an array!!"
For x=0 To UBound(objProperty)-1
strProp=strProp & " " &objProperty(x) & VbCrLf
Next
End If
Else
strProp=objItem.Get(strProperty)
If strProp="" Then strProp="Defined but no value"
End If
Else
strProp="Not Defined"
End If
GetValue=strProp
End Function
--
Jeffery Hicks MCSE, MCSA, MCT
Microsoft PowerShell MVP
http://www.scriptinganswers.com
http://www.powershellcommunity.org
http://jdhitsolutions.blogspot.com
Now Available: WSH and VBScript Core: TFM
Now Available: Windows PowerShell v1.0: TFM 2nd Ed.
"AaronK" <aar...@fake-email.com> wrote in message
news:uo9YvRcX...@TK2MSFTNGP06.phx.gbl...
The code Jeffrey posted should reveal all of the attributes available for
local user objects. It should include:
passwordAge (in seconds)
passwordExpired (time when password expired)
lastLogin (when user last logged in)
minPasswordAge
You would need to calculate when the password was last set and when it
expires. A VBScript program do dump out all local user accounts on a
computer could be similar to:
=====
' Bind to computer object.
Set objComputer = GetObject("WinNT://MyComputer")
' Filter on user objects.
objComputer.Filter = Array("user")
' Enumerate all user objects.
For Each objUser In objComputer
On Error Resume Next
dtmLast = objUser.lastLogin
If (Err.Number <> 0) Then
dtmLast = "Never"
End If
On Error GoTo 0
Wscript.Echo objUser.Name _
& ", " & objUser.passwordAge _
& ", " & dtmLast
Next
===========
I trapped the possible error if lastLogin has no value so the script does
not stop.
--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--
Great scripts
Aaron
"Richard Mueller [MVP]" <rlmuelle...@ameritech.nospam.net> wrote in
message news:eB2mibdX...@TK2MSFTNGP06.phx.gbl...