So I am in need of some assistance. I got put on a project, involving writing a powershell script. And I need to be able to get the most recent SuccessAudit from the security log in a Windows 7 machine, ID=4776.
I managed to get this done in a couple of hours, it is my first time using powershell.
$eventtime=Get-EventLog Security | {$_.EventId -eq 4776} | where {$_.entrytype -eq "SuccessAudit"} | Select-Object TimeGenerated | Select -first 1
Output via console (w/o setting a variable):
TimeGenerated
--------------------------
4/10/2013 10:35:01 PM
If i set the command to a variable, this is the result of the variable:
@{TimeGenerated=4/10/2013 10:35:01 PM}
I would like to cut the variable so that it will only equal the date and time: 4/10/2013 10:35:01 PM
Help! I've been at it for hours!