Skip to content

Instantly share code, notes, and snippets.

@raandree
Last active April 18, 2020 16:42
Show Gist options
  • Save raandree/5e675d28ccc72cb55ab3808007bda5f4 to your computer and use it in GitHub Desktop.
Save raandree/5e675d28ccc72cb55ab3808007bda5f4 to your computer and use it in GitHub Desktop.
Debug DSC code running in a different process
#usually the process consuming the most memory is the DSC one
$p = Get-Process -Name WmiPrvSE -IncludeUserName |
Where-Object UserName -eq 'NT AUTHORITY\SYSTEM' |
Sort-Object -Property WS -Descending |
Select-Object -First 1
Enter-PSHostProcess -Process $p -AppDomainName DscPsPluginWkr_AppDomain
$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