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.6 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>"
Next
in External plugins by (340 points)

2 Answers

0 votes
Hi,

Use win32_Session or win32_LogonSession class.

Regards

Frank
by (70.3k points)
0 votes
hi,

thanks Frank, it is the solution :-)

found a script,i could adapt:

http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/Q_26498122.html
by (340 points)
edited by
 
Powered by Question2Answer
...