With WSH you can easily use Windows Management Instrumentation (WMI). The following scripts demonstrate using WSH and WMI to retrieve a user's logon time via ADSI.
Example
Copy Code | |
---|---|
// JScript. LoginProfiles = GetObject("winmgmts:").InstancesOf ("Win32_NetworkLoginProfile"); for(e = new Enumerator(LoginProfiles) ; !e.atEnd() ; e.moveNext()) { Profile = e.item(); WScript.Echo(Profile.Name); WScript.Echo(Profile.LastLogon); } ' VBScript. Set LoginProfiles = GetObject("winmgmts:").InstancesOf ("Win32_NetworkLoginProfile") for each Profile in LoginProfiles WScript.Echo Profile.Name WScript.Echo Profile.LastLogon next |
Note |
---|
For more information on WMI, see the WMI SDK at |