2017-11-30 2 views
0

cmdlet Test-NetConnection이 Server 2012에 설치되어 있지 않은 것으로 나타났습니다. Server 2012에 PowerShell 버전 3이 포함되어 있으므로 최신 버전 5.1로 업데이트하는 데 도움이 될 것으로 생각됩니다.PowerShell cmdlet Test-NetConnection을 사용할 수 없음

업데이트를 수행했지만 cmdlet Test-NetConnection은 아직 사용할 수 없습니다.

Test-Connection 만 존재하지만 포트를 테스트하려면 Test-NetConnection이 필요합니다.

지금 Test-NetConnection을 어떻게받을 수 있습니까?

 
PS C:\Windows\system32> $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.34209 
WSManStackVersion    3.0 
PSRemotingProtocolVersion  2.3 
SerializationVersion   1.1.0.1 


PS C:\Windows\system32> Get-Command Test-NetConnection 
Get-Command : The term 'Test-NetConnection' 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-Command Test-NetConnection 
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : ObjectNotFound: (Test-NetConnection:String) [Get-Command], CommandNotFoundException 
    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand 

답변

1

많은 cmdlet의 가용성은 PowerShell 버전이 아니라 Windows 버전과 관련이 있습니다. Windows 버전을 업그레이드 할 수없는 경우 Test-NetConnection을 가질 수 없습니다. 자신을

당신은 포트 테스트를 위해 nmap 또는 scanline 같은 명령 줄 포트 스캐너를 사용할 수 있거나 포트 (들)에 연결할 수 있습니다 : 너무 나쁜

function Test-Port($server, $port) { 
    $client = New-Object Net.Sockets.TcpClient 
    try { 
     $client.Connect($server, $port) 
     $true 
    } catch { 
     $false 
    } finally { 
     $client.Dispose() 
    } 
} 
+0

합니다. 나는 지금 그걸 고수해야한다. 이 cmdlet은 추가 설치가 필요하지 않으므로 매우 편리합니다. 나는 대단히 감사합니다 yor 기능, 작품처럼 매력! 고맙습니다! –

관련 문제