Hi all,
i have this:
Invoke-Command -ComputerName $i.computer -ScriptBlock { Get-Eventlog -LogName system | Where-Object {$_.EventID -eq "6008"} }
if i write it out to a text file all values shows correct, but it shows me alot of other data i dont want. So if i only want the vlaue Machinename, Time, EventID and Message in a csv file
example:
$Result= Invoke-Command -ComputerName $i.computer -ScriptBlock { Get-Eventlog -LogName system |
Where-Object {$_.EventID -eq "6008"} }
$objcsv = new-object PSObject
$objcsv | add-member NoteProperty computer $result.machinename
$objcsv | add-member NoteProperty Time $Result.Time
$objcsv | add-member NoteProperty EventID $Result.EventID
$objcsv | add-member NoteProperty Message $Result.Message
$objcsv | export-csv "D:\Powershell\Get Event\outputfile_event.csv" -append -notypeinformation -Force
the output is :
"computer","Time","EventID","Message"
"System.Object[]","System.Object[]","System.Object[]","System.Object[]"
do i have to convert the value to a string ? and if so how ...
thanks..