Skip to content

Instantly share code, notes, and snippets.

@raandree
Created July 29, 2019 10:07
Show Gist options
  • Save raandree/b6f22fd2b9934a9d4d656fd2ec196452 to your computer and use it in GitHub Desktop.
Save raandree/b6f22fd2b9934a9d4d656fd2ec196452 to your computer and use it in GitHub Desktop.
This script attaches to the DSC LCM's PSHostProcess for debugging the runspace that is in state 'AtBreakpoint'
#usually the process consuming the most memory is the one that hosts the LCM
$p = Get-Process -Name WmiPrvSE | Sort-Object -Property WS -Descending | Select-Object -First 1
Enter-PSHostProcess -Process $p -AppDomainName DscPsPluginWkr_AppDomain
Start-Sleep -Seconds 1
$rs = Get-Runspace | Where-Object { $_.Debugger.InBreakpoint }
Debug-Runspace -Runspace $rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment