BornToBeRoot/PowerShell_IPv4PortScanner

[Feature Request] Catch Exception from calling EndInvoke and recommend/dynamically reducing Threads

Open

#5 创建于 2024年8月9日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)PowerShell (59 fork)github user discovery
enhancementhelp wanted

仓库指标

Star
 (243 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

This is a feature request to add dynamic Thread reduction when EndInvoke function causes any kind of exception. Otherwise, exit early with a message to recommend for the -Threads parameter to be used.

Specifically this error that I ran into because the default 500 threads is too high for my virtual lab:

Exception calling "EndInvoke" with "1" argument(s): "Thread failed to start."
At C:\temp\IPv4PortScan.ps1:260 char:13
+             $Job_Result = $Job.Pipe.EndInvoke($Job.Result)
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ThreadStartException
 
Exception calling "EndInvoke" with "1" argument(s): "Thread is running or terminated; it cannot restart."

贡献者指南