Skip to content

Instantly share code, notes, and snippets.

@AlesRuzickaEu
Created September 4, 2015 11:12
Show Gist options
  • Save AlesRuzickaEu/73858d63792f363d37c4 to your computer and use it in GitHub Desktop.
Save AlesRuzickaEu/73858d63792f363d37c4 to your computer and use it in GitHub Desktop.
Powershell script to print svclog files
Param
(
[Parameter(Mandatory=$true,
ValueFromPipelineByPropertyName=$true,
Position=0)]
[string[]]
$Path,
[switch]
$ErrorOnly
)
[xml]$logFile = "<R>" + (Get-Content $Path) + "</R>"
foreach ($item in $logFile.R.E2ETraceEvent)
{
if (-not $ErrorOnly -or $item.System.SubType.Name -eq "Error")
{
Write-Output (new-object psobject -Property @{
Type = $item.System.SubType.Name
Time = Get-Date $item.System.TimeCreated.SystemTime
Text = $item.ApplicationData
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment