Jeffery
Wed Jan 23 07:52:39 CST 2008
Here's a scheme browsing script I've used in the past. When prompted, enter
the ADSIpath for an object like WinNT://Computer01/Administrator,user
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" <aaronk@fake-email.com> wrote in message
news:uo9YvRcXIHA.4684@TK2MSFTNGP06.phx.gbl...
> I am looking for a method to return properties for all the user accounts
> on a local machine, similar to the "net user username". I have found a
> script that will return all the users and some properties but not the ones
> I am particularly looking for such as "password last set" and "last
> logon". Example of the information I am trying to get for all users on the
> local machine. Any help would be great.
>
> 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
>