Networking Introspection CmdLets are not available cross-platform #6076
Comments
|
Many if not all of the net* modules are based on CIM classes that are only available on Windows 8 and later. Either those CIM classes would have to be ported to the other platforms - currently no CIM classes have been or are earmaked for porting as far as I'm aware - or the cmdlets would need to be rewritten to use the appropriate method of retrieving the data on each platform which is a non-trivial task |
|
Advanced and ported Test-Connection cmdlet #5328 Resolve-DnsName can be easily implemented (with some seizures). The remaining cmdlets are more difficult to implement because of the lack of standard APIs. |
|
@iSazonov could you maybe share the Resolve-DnsName code? |
|
@GrimSmiler I am not owner the cmdlet.. :-) MSFT is an owner. And the cmdlet is out of the repo. I'd can re-create the cmdlet in the repo if we would get encouragement. Our policy requires the creation of an RFC. You could grab this if you want to get this cmdlet. |
|
@iSazonov Then shall we create a feature request in https://github.com/dotnet/core or maybe https://github.com/dotnet/corefx about accessing such features? |
|
@FranklinYu Seems it is out of CoreFX. CoreFX implements only base APIs. Interface management and route management is more high API level. Perhaps we could consider CIM. In any case, you need first do more research before make feature requests. |
|
@iSazonov I'm not familiar with CIM, but I thought it's only available on Windows, isn't it? |
|
@FranklinYu There is OMI project for portable implementation of CIM |
|
IIUC if we implement those cmdlets in PowerShell with CIM, we need to include OMI in the package for non-Windows operating system, right? |
|
OMI is another project and you can freely install OMI on non-Windows systems. The current plan for the repo is the reverse — eliminate dependence on OMI native client library and implement WSMan client on managed code to get better compatibility for all platforms. |
|
@iSazonov I’m having some issue looking up the documentation. |
|
No, it is a Windows component. |
|
@iSazonov Then I don’t quite understand why it says that. When I select “Windows 10” in the Product list, it says
So the Cmdlet works, but it is no longer documented? Is it deprecated? |
|
Might be a documentation issue? I have |
|
It looks as doc issue. You could report on the web page or PowerShell-Docs repo. |
|
@vexx32 |
|
Ah, yeah. I don't think I changed my $env:PSModulePath, but I might have. It does work but I'm not sure if PS Core searches in the WinPS module paths by default or if I added that into my environment variables directly at some point. |
|
If you look |
|
@iSazonov I can confirm with Windows 10 1809. This is not available for Windows 10 1803 (which is still the majority). I'm wondering how do I write my own Cmdlet that are compatible with both Windows PowerShell and PowerShell Core, like DnsClient in this case? |
|
@FranklinYu I recently wrote some docs on writing portable modules. It's not merged yet as it's still under review, but you can take a look at the PR for the content. Regarding OMI above. My current recommendation is to not take a dependency on OMI. |
I would like to help (because I myself need this Cmdlet). I did some research but there doesn't seem to be any built-in API (from .NET Core) to call, if we need record types like It seems like the |
|
@FranklinYu .Net has TcpClient and UdpClient and we could easily implement any type request to DNS service. But it is better contribute to .Net CoreFX to enhance |
|
I think this is related: dotnet/corefx#13890 I would try pushing that issue instead. |
|
I think it would take long for CoreFX to pick them up. According to the CoreFX network team, they will be focusing on HTTP/3 once CoreFX 3.0 is released, so I guess it would be at least a year before they can put priority back to this DNS feature. Would it be possible to use community package |
|
@FranklinYu DnsClient is for .Net Framework. |
|
@iSazonov It works in .NET Standard, according to NuGet. The package description is out of date; check the "Dependencies" section. Where makes you think it's for .NET Framework only? I'll contact the author to fix it. |
|
Looking at the DnsClient.NET repo, it appears to work with .Net Core 2.0 and even mentions Linux. However, this seems like a module that may be best created and supported by the community and shipped on PSGallery. |
|
Is there any way to write a module to do "polyfill", that is to provide certain Cmdlet only if it is not available as built-in? Otherwise, the module won't install on new version of PowerShell with |
|
Typically, importing a module that contains a command that already exists will error, but you can -AlowClobber to force the import, and any conflicting commands are overridden with the new ones. |
|
@vexx32 That’s exactly the thing I want to avoid.
|
MSFT has many useful modules which is not ported. |
|
@iSazonov Much easier said than done. Most of the Microsoft teams that own PowerShell modules are only doing closed source, so there's a big learning curve and work involved to make their code Open Source (legal review, private API usage, tests runnable by contributors outside of Microsoft environment, etc...). Also, making source code open is easy, but maintaining an active repo with the community takes resources that are likely not available. I suspect that many of the current teams that own a module have none of the original engineers that wrote that module and are only being maintained and not enhanced. There are some teams producing new PS modules and they may be more open to starting as Open Source, but we usually don't know about them until they're ready for release. The best way to encourage a team to port or Open Source their module is to give them direct feedback through their feedback channel (which is probably UserVoice). You'll need to get others to support the cause if you want it to be prioritized higher or taken seriously. Teams do take customer feedback more critically than feedback from the PowerShell team. |
|
@SteveL-MSFT Thanks for clarify!
I guess it is unreal and haven't benefits. My suggestion is to start new projects to get ported modules. |
|
@SteveL-MSFT and others Just jumping in here to clarify:
DnsClient.NET works totally fine cross platform on Linux etc. The only problem a couple years ago was to resolve the System's DNS servers in case the user doesn't provide any. But that should not be an issue anymore since .NET Core 2.2 I think. All the other DNS protocol implementation simply uses UDP and/or TCP clients and sockets which are ported via .NET Core just fine. If there is anything I can help you with, like something is missing or blocking you using DnsClient, just ask or send a PR ;) |
|
#12910 makes me think that, if a cross-platform Possibilities:
|
|
Is there a reason a Resolve-DnsName cmdlet can't simply use the |
|
On PowerShell 7.1.0-preview.3: So the CNAME chain and TTL values are not available. |
|
Also, the methods of |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

CmdLets in the NetTCPIP & other Net* modules are not available cross-platform.
My use-case: we use powershell + netCore as a cross-platform develop & deploy solution. (It's great!)
If I might offer an order of priorities based on that use-case, I would prioritise
Rationale: In container and serverless application/service deployment, the ability (and hence the need) to mutate hardware and security configuration is limited; but the need to inspect network configuration does not go away.
So top of my list are:
Environment data
The text was updated successfully, but these errors were encountered: