I am making a script that pulls all non-empty logs and saves them as either evtx, csv, or xml. I have got the script working for the base logs (application, security, system, etc.), and those that have spaces. However, I keep getting errors with any that have forward slashes (/
) in them (e.g. Microsoft-Windows-Ntfs/Operational
). I tried swapping the /
out with dash, spaces, abbreviated, and underscores: they all result in the error below.
Note: I am am using -newest 20
in the code for testing, to ease the load and save time.
Example of Code (Get the same results with either):
get-eventlog -log "Microsoft-Windows-Ntfs/Operational" -newest 20
OR
$Logname = "Microsoft-Windows-Ntfs/Operational"
get-eventlog -log $logname -newest 20`
ERROR:
get-eventlog : The event log 'Microsoft-Windows-Ntfs/Operational' on computer '.' does not exist.
At line:1 char:1
+ get-eventlog -log "Microsoft-Windows-Ntfs/Operational" -newest 20
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-EventLog], InvalidOperationException
+ FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.PowerShell.Commands.GetEventLogCommand