Welcome to OCS Inventory NG community support, where you can ask questions and receive answers from other members of the community.

Please ask questions only in English or French.

Release 2.11.1 available

The official documentation can be found on http://wiki.ocsinventory-ng.org. Read it before asking your question.

vbs plugin to find login time

is it possible to have the timestamp of when the current user  logged in windows?

i couldn't find it in win32_computersystem. for the moment i use the detectiontime

my code:

On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputer = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colComputer
Wscript.Echo "<USERHISTO>"
Wscript.Echo "<LOGONUSERNAME>"
Wscript.Echo objComputer.UserName
Wscript.Echo "</LOGONUSERNAME>"
Wscript.Echo "<DETECTION>"
Wscript.Echo year(date) & "-" & month(date) & "-" &  day(date) & "T" & time & "+00:00"
Wscript.Echo "</DETECTION>"
Wscript.Echo "</USERHISTO>"
in External plugins by (340 points)

2 Answers

0 votes

Use win32_Session or win32_LogonSession class.


by (88.5k points)
0 votes

thanks Frank, it is the solution :-)

found a script,i could adapt:

by (340 points)
edited by
Powered by Question2Answer