3

Why are cmdlets like Test-NetConnection no longer available? It appears the entire NetTCPIP module is not in v6. Is there a list of depreciated cmdlets in Powershell Core?

Get-Module -n Microsoft.PowerShell.Management | select -exp ExportedCommands in v6 is about half that in v5.

  • I'm not sure about the specific cmdlet that you are asking about but yes, V6 has many fewer cmdlets than v5 and will probably continue to have fewer for quite some time. Unless you are explicitly writing *nix or cross platform compatible scripts you should probably be using v5. – EBGreen May 7 '18 at 15:17
  • 1
    PowerShell 6 is the multi-platform version of PowerShell which means it only supports those cmdlets that were ported. Windows-specific cmdlets were not ported, as they wouldn't be usable, under those other platforms. – Ramhound May 7 '18 at 15:39
  • You might get more information asking this question on stackoverflow.com. – Tripp Kinetics May 7 '18 at 18:10
  • @TrippKinetics Not likely. The answer is that V6 has fewer cmdlets than windows specific versions. Period. – EBGreen May 7 '18 at 18:21
  • 1
2

PowerShell 6 is cross-platform, so cmdlets that relied on native functions had to be rewritten or removed. Apparently Microsoft never got around to reimplementing Test-NetConnection for other platforms. Cmdlets that manage Windows-only systems (e.g. Storage Spaces) all had to be removed. To produce a list of all the missing cmdlets, you can use PowerShell!

First run this in PowerShell 5:

Get-Command | select Name, Source | Export-Csv .\cmds5.csv

Then run it again in PowerShell 6 with a different output file:

Get-Command | select Name, Source | Export-Csv .\cmds6.csv

We can then analyze the files for differences using either PowerShell version:

$cmd5 = Import-Csv .\cmds5.csv
$cmd6 = Import-Csv .\cmds6.csv
$gone = $cmd5 | ? { $n = $_.Name; ($cmd6 | ? { $_.Name -eq $n }) -eq $null }
$new = $cmd6 | ? { $n = $_.Name; ($cmd5 | ? { $_.Name -eq $n }) -eq $null }

I tested this in a Windows 10 1703 x86 VM that should have pretty fresh PowerShell environments. I used v6.0.2 for PowerShell 6, the most recent stable version. Of the 1493 commands in PowerShell 5, 1139 were removed in PowerShell 6. I put them all in a gist. Of the 425 commands in PowerShell 6, 71 are new, all but three of which have to do with desired state configuration. Those last three are Get-Uptime, Remove-Alias, and Remove-Service. You can see all new commands in this other gist.

  • Interesting that those last three are missing from powershell 5.1 too... – Brain2000 Jan 23 at 15:04
  • Is there a way to get the missing cmdlets so I can use them in Powershell 6? I use Start-BitsTransfer a lot, for example. – Ray 2 days ago
  • @Ray This module claims to enable the use of Windows-specific modules. However, it seems to require WinRM being on. – Ben N 2 days ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.