Last active
March 7, 2022 09:09
-
-
Save batzen/84790c26757c3420c5ee to your computer and use it in GitHub Desktop.
Short PowerShell script to start sxstrace, stop sxstrace and open the resulting trace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) | |
{ | |
Write-Warning "You do not have Administrator rights to run this script!`nPlease re-run this script as an Administrator!" | |
break | |
} | |
$logfile = (Join-Path $env:temp sxstrace.log) | |
$outfile = (Join-Path $env:temp sxstrace.txt) | |
Write-Output "Starting sxstrace utility..." | |
sxstrace trace -logfile:$logfile -nostop | |
Write-Output "Press any key to stop tracing" | |
Read-Host | |
sxstrace stoptrace | |
&sxstrace parse -logfile:$logfile -outfile:$outfile | |
Invoke-Item $outfile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment