How to know the port number of the remote MS SQL server?
The crux of the matter, we have n servers and access them via WMI to collect info on ports on which hang the instances? That is, there is a server on which revolves a couple of instances they have ports, how to know what ports and to which the instance belong to? The version of "come and see" is not very suitable in connection with the number of servers.
WMI can not issue a list of your current processes, network ports, so using this method to fail.
Of the standard means possible in this way: raise the WS-Management via the PS-Remote run a script that defines a match "the id of the MS SQL ports". The easiest script would be to run with ansible, but I suspect that you are under a Linux-Ohm sit and WSL for this set is not comme Il faut.