How do I get PowerShell 4 cmdlets such as Test-NetConnection to work on Windows 7?

后端 未结 7 796
刺人心
刺人心 2021-02-07 05:27

The situation. On a Windows 7 SP1 machine, I have updated with Windows6.1-KB2819745-x64-MultiPkg.msu. Furthermore, in PowerShell $PSVersionTable now reports ‘PSVersion 4.0’.

7条回答
  •  伪装坚强ぢ
    2021-02-07 05:45

    At least Test-NetConnection can be ported back to Windows 7. Just copy folders NetTCPIP, DnsClient, and NetSecurity from the supported Windows machine with the same PowerShell version (Windows 8.1, Windows 10, etc). Folder - C:\Windows\System32\WindowsPowerShell\v1.0\Modules. Then Import-Module -Name C:\Windows\System32\WindowsPowerShell\v1.0\Modules\NetTCPIP -Verbose

    Alternatively, you can import a module from a remote machine (say win2012):

    $rsession = New-PSSession -ComputerName win2012
    Import-Module NetTCPIP -PSSession $rsession
    

    I have had the same problem on my Windows 7 x64 and both solutions worked for me as of PowerShell 5.1.

提交回复
热议问题