In order to determine logon and logoff times for a given day on my Windows PC, I've used the following script in Windows PowerShell run as administrator:
Get-WinEvent -FilterHashtable @{starttime='5/6/2018';endtime='5/7/2018';logname='security';id=4648,4634}
I've tried and determined that the above does not work when PowerShell is not run as administrator. Local admin privilege will soon be taken away on the PC on which I need to run this script - which I think means I will no longer be able to run PowerShell as administrator. Is there an alternative that I can run from Powershell or the standard CLI by which I can determine logon and logoff times for a given day?
If relevant, the PC is running Windows 7 Enterprise.
Answer
You could create a scheduled task which is activated whenever one of the relevant events occurs, and writes the desired event info to a log file which is accessible to your non-admin user.
No comments:
Post a Comment