Skip to content

Instantly share code, notes, and snippets.

@sassdawe
Created July 25, 2021 12:36
Show Gist options
  • Save sassdawe/5ca66461d86484c556de1537c99b0ebd to your computer and use it in GitHub Desktop.
Save sassdawe/5ca66461d86484c556de1537c99b0ebd to your computer and use it in GitHub Desktop.
Debug in PowerShell with rolling log file
Function Debug-PowerShell() {
[CmdletBinding()]
[Alias("dbps")]
param (
[string]$Path = "$ENV:TEMP\psdebu.log"
)
$Global:DebugLog = $Path
New-Item $Global:DebugLog -Force -ItemType File
Start-Process powershell -ArgumentList "-noprofile","-command &{Get-Content '$DebugLog' -Wait}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment