Powershell 6 missing cmdlets

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.

root

Posted 2018-05-07T15:06:52.970

Reputation: 2 992

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 – 2018-05-07T15:17:57.253

1PowerShell 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 – 2018-05-07T15:39:13.420

You might get more information asking this question on http://stackoverflow.com/.

– Tripp Kinetics – 2018-05-07T18:10:06.950

@TrippKinetics Not likely. The answer is that V6 has fewer cmdlets than windows specific versions. Period. – EBGreen – 2018-05-07T18:21:03.220

@Ramhound Note that at least some of the NetTCPIP cmdlets are not inherently Windows specific. Unless they touch very low level OS interfaces, they can at least theoretically be ported. Test-NetConnection should actually be pretty easy, it's just a port of the old BSD ping command with typical MS 'different just to be different' changes. – Austin Hemmelgarn – 2018-05-07T19:30:42.807

1

@AustinHemmelgarn - The comment was very generalized. In this case, the NetTCPIP PowerShell module only exist within the Windows and has not been ported to PowerShell 6.

– Ramhound – 2018-05-07T20:01:18.050

I will also point out that since Powershell V6 is open source, if it is missing something that you feel it should have, just head on over to github and start coding. – EBGreen – 2018-05-07T20:04:59.247

Answers

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.

Ben N

Posted 2018-05-07T15:06:52.970

Reputation: 32 973

Interesting that those last three are missing from powershell 5.1 too... – Brain2000 – 2019-01-23T15:04:25.597

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 – 2019-12-10T16:04:15.383

@Ray This module claims to enable the use of Windows-specific modules. However, it seems to require WinRM being on.

– Ben N – 2019-12-10T21:40:37.863