How to enumerate all the network connection names?

  • Thread starter Thread starter YXQ
  • Start date Start date
Y

YXQ

I want to get all the connection names, for example BroadBand Connection1,
BroadBand Connection2..., using API or

WMI? can anyone give the code? thank you very much.
 
YXQ said:
I want to get all the connection names, for example BroadBand
Connection1, BroadBand Connection2..., using API or

WMI? can anyone give the code? thank you very much.

Try:

System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces
System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces
System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces
System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces
System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces
System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces


Armin
 
Armin Zingler said:
Try:

System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces
System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces
System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces
System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces
System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces
System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces

Armin

You missed one!
System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces
 
#Function to Create an array containing the name of the Network Connections
on the Computer.

function func_Connection_Names()
{

$inter =
[system.Net.NetworkInformation.NetworkInterface]::GetAllNetworkInterfaces()

[string[]]$NIC = @()

foreach ($a in $inter)
{

$NIC+=$a.Name
}

$counter = 0

while ($counter -lt $NIC.count) {

$NIC[$counter] >> init_code.txt

$counter++
}
}
 
M ashraf,

Misclicked?

I don't see what program language you are using, but for sure it is not any
VB dialect and for sure not dotnet.

Cof
 
M ashraf,

Misclicked?

I don't see what program language you are using, but for sure it is not any
VB dialect and for sure not dotnet.

Cof

PowerShell - and yes it is .net :) Not VB though
 
Tom,

Thanks, I don't know how you did know that I was interested in that.

Cor

M ashraf,

Misclicked?

I don't see what program language you are using, but for sure it is not
any
VB dialect and for sure not dotnet.

Cof

PowerShell - and yes it is .net :) Not VB though
 
Back
Top