Windows Script Host  

WSH and Windows Management Instrumentation (WMI)

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.

Note   For more information on WMI, see the WMI SDK at (
// JScript.
LoginProfiles = GetObject("winmgmts:").InstancesOf ("Win32_NetworkLoginProfile");
for(e = new Enumerator(LoginProfiles) ; !e.atEnd() ; e.moveNext())
   Profile = e.item();

' VBScript.
Set LoginProfiles = GetObject("winmgmts:").InstancesOf ("Win32_NetworkLoginProfile")
   for each Profile in LoginProfiles 
      WScript.Echo Profile.Name
      WScript.Echo Profile.LastLogon

See Also

Basic Windows Script Host Tasks