Wednesday, July 2, 2008

Still relatively confused on how to use the .NET through Powershell. Here are some simple examples that were easy to find because they have accessible overloaded interfaces (??):

$Ping = new-object System.Net.NetworkInformation.ping
$Ping.Send("192.168.0.1")
Status : Success
Address : 192.168.0.1
RoundtripTime : 1 ms
BufferSize : 32
Options : TTL=127, DontFragment=False


[System.Net.Dns]::Resolve("google.com") | fl *
HostName : google.com
Aliases : {}
AddressList : {64.233.167.99, 72.14.207.99, 64.233.187.99}


[System.Net.Dns]::GetHostName()
rmfmedia

[System.Net.NetworkInformation.NetworkInterface]::GetAllNetworkInterfaces()

Id : {0348D5D7-6D83-44C8-B556-B29466698340}
Name : Wireless Network Connection
Description : Intel(R) PRO/Wireless 3945ABG Network Connection - Packet Scheduler Miniport
NetworkInterfaceType : Ethernet
OperationalStatus : Up
Speed : 54000000
IsReceiveOnly : False
SupportsMulticast : True
....

[System.Net.NetworkInformation.NetworkInterface]::GetIsNetworkAvailable()
True

No comments: