I am trying to filter the data contains in excel. but it showing error.
Import-Csv -Path "D:\Excel\Data\List.csv" -Header "EventID", "TimeCreated", "Computer", "TargetUserName", "SubjectUserName", "HOSTName", "Filename" |
Where-Object {[INT]$_.TargetUserName -eq 122388} |
Select-Object "EventID", "TimeCreated", "Computer", "TargetUserName", "SubjectUserName", "HOSTName", "Filename" |
Export-Csv "D:\Excel\test.csv" -NoTypeInformation


-headerparameter you adding an extra header to the already existing header. Therefore the existing header becomes the first row where the top cell in theTargetUserNamecontains the string"TargetUserName"which can't be converted to an integer. Long story short: lose the-headerparameter.122388 -eq $_.TargetUserName) you will do a number (integer) compare.