提问人:mrswadge 提问时间:7/19/2022 最后编辑:mrswadge 更新时间:7/19/2022 访问量:1586
Windows Server 2008 R2 和 Get-NetTCPConnection cmdlet
Windows Server 2008 R2 and Get-NetTCPConnection cmdlet
问:
我们有一台旧服务器,那里的一些软件似乎耗尽了端口,所以我们试图按照一些文档来追踪罪魁祸首。我热衷于尝试 PowerShell Get-NetTCPConnection,看看我们是否可以控制某些东西来占用它们。下面的文档指出,在 Windows Server 2008 R2 上,可以更新 PowerShell 以包含该命令,但我正在努力找到执行此操作的更新。
使用 PowerShell 5.1,我得到了以下内容:
PS C:\> Get-NetTCPConnection
Get-NetTCPConnection : The term 'Get-NetTCPConnection' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
At line:1 char:1
+ Get-NetTCPConnection
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-NetTCPConnection:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
https://learn.microsoft.com/en-us/windows/client-management/troubleshoot-tcpip-port-exhaust#troubleshoot-port-exhaustion 状态 - “对于 Windows 7 和 Windows Server 2008 R2,可以更新 PowerShell 版本以包含上述 cmdlet [Get-NetTCPConnection]。
我们正在运行 PowerShell 5.1。
我尝试使用 PowerShell 命令行添加 NetTCPIP 模块,但这对我不起作用。Install-Module -Name NetTCPIP
我错过了什么?
PS C:\> $host
Name : ConsoleHost
Version : 5.1.14409.1005
InstanceId : 6b4acbbe-854d-42bd-b8a0-3685836fa9fb
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : en-GB
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled : True
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
PS C:\> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.14409.1005
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14409.1005
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
答:
0赞
SikorskyS60
7/19/2022
#1
Microsoft Doc 还说了以下内容:
对于 Windows 7 和 Windows Server 2008 R2,可以使用以下脚本以定义的频率收集 netstat 输出。从输出中,您可以看到端口使用趋势。
@ECHO ON
set v=%1
:loop
set /a v+=1
ECHO %date% %time% >> netstat.txt
netstat -ano >> netstat.txt
PING 1.1.1.1 -n 1 -w 60000 >NUL
goto loop
你已经试过了吗?
评论
0赞
mrswadge
7/20/2022
谢谢你的建议。不,我没有。我会试一试。
评论