I am having the hardest time with putting together a wrapper for the tracerpt.exe command in PowerShell. I have tried all my normal tricks for getting spaces in command arguments but, the tracerpt.exe command errors if a wrapper the arguments with quotes. also it seems my dashes are getting stripped out and I don't know why. If anyone knows how I can format the arguments to keep the dashes and the spaces without sending the quotes and really be greatful for the help.
Also, if some one know a better way of converting an ETL to an XML format in PowerShell I'd would be all for a different solution.
Function Convert-ETLtoXML
{
param
(
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
[string]$ETLinputFile
)
$space = [char]32
[string]$confrimOverWrite = '-y'
[String]$format = "-of" + $space + "XML"
[string]$outfile = "-o" +$space + "xxyy.xml"
[string]$command = 'C:\Windows\system32\tracerpt.exe'
Write-Host -ForegroundColor Red "$command $ETLinputFile $confrimOverWrite $format $outfile"
& $command $ETLinputFile $confrimOverWrite $format $outfile
}
Convert-ETLtoXML -ETLinputFile .\DEMO.etl
output:
C:\Windows\system32\tracerpt.exe .\DEMO.etl -y -of XML -o xxyy.xml
Argument 'of XML' is unknown.
Argument 'o xxyy.xml' is unknown.
Error: The parameter is incorrect.