Custom Inventory Rule: User Login History
Can someone help me with creating a custom inventory rule to create a user login history? This has been requested to see how often certain computers are being used. I've heard that this can be done from being in the KKE Open Forums, but it was never demonstrated.
Please and thank you!
Answers (1)
You can use a script to push a batch file to machines if you only want to track a couple
Place the batch file someplace the CIR can find it. ( if you want to do this domain wide or for a large domain group put the line in the domain or group login script instead of a batch file)
I use C:\ProgramData\Quest\KACE\user for my Kace files and tasks
login.bat:
echo Logon: %date% %time:~0,5% %UserName% >> C:\ProgramData\Quest\KACE\user\History.txt
Then create a key under the HKLM run keyset to call the batch file on login: ( if you use the domain method this is not needed)
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"logon history"="c:\\ProgramData\\Quest\\KACE\\user\\login.bat"
It creates a file that looks like this:
Then create a cir to look for that file and call it
ShellCommandTextReturn(cmd /c if exist C:\ProgramData\Quest\KACE\user\history.txt type C:\ProgramData\Quest\KACE\user\history.txt)