Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 获取挂起脚本的行号_Windows_Powershell_Automation_Powershell 2.0_Powershell 3.0 - Fatal编程技术网

Windows 获取挂起脚本的行号

Windows 获取挂起脚本的行号,windows,powershell,automation,powershell-2.0,powershell-3.0,Windows,Powershell,Automation,Powershell 2.0,Powershell 3.0,我最近“继承”了一个复杂的PowerShell脚本,它通过任务调度器在后台执行任务。现在我们看到脚本在某些情况下挂起,但直到现在我还无法确定根本原因 有没有办法对已经运行的脚本进行pol或附加调试器,这样我就可以在不重写大部分内容的情况下获得当前行号?在当前状态下,脚本的可维护性低于20k行代码 我尝试检查WMI的属性,但没有发现任何有用的内容。我确实找到了一个可能有用的计时脚本https://powershellexplained.com/2017-02-05-Powershell-Chron

我最近“继承”了一个复杂的PowerShell脚本,它通过任务调度器在后台执行任务。现在我们看到脚本在某些情况下挂起,但直到现在我还无法确定根本原因

有没有办法对已经运行的脚本进行pol或附加调试器,这样我就可以在不重写大部分内容的情况下获得当前行号?在当前状态下,脚本的可维护性低于20k行代码

我尝试检查WMI的属性,但没有发现任何有用的内容。我确实找到了一个可能有用的计时脚本
https://powershellexplained.com/2017-02-05-Powershell-Chronometer-line-by-line-script-execution-times/

我还编写了一个调试包装器,但挂起只在某些情况下发生。我无法按需复制


谢谢

您是否查看了
输入PSHostProcess

Enter-PSHostProcess
cmdlet连接并进入与本地进程的交互式会话。远程交互式会话不是创建新进程来承载PowerShell并运行远程会话,而是在已运行PowerShell的现有进程中运行。在与指定进程上的远程会话交互时,可以枚举运行的运行空间,然后通过运行
debug runspace
Enable RunspaceDebug


您是否看过
输入PSHostProcess

Enter-PSHostProcess
cmdlet连接并进入与本地进程的交互式会话。远程交互式会话不是创建新进程来承载PowerShell并运行远程会话,而是在已运行PowerShell的现有进程中运行。在与指定进程上的远程会话交互时,可以枚举运行的运行空间,然后通过运行
debug runspace
Enable RunspaceDebug


您是否尝试过使用
开始转录本
?otta会告诉你在挂起之前事情的进展。你试过使用
Start Transcript
?奥塔告诉你绞刑前的情况。