Display: Cloud | List
Most Popular Tags
Results (3 total) All > powershell (x) > system.net (x)
A simple PowerShell example of using the Parse method of the PhysicalAddress class (PhysicalAddress.Parse Method (System.Net.NetworkInformation))
$IPAddress = '10.10.10.1'Write-Host 'Test that the IP address works' $IP = Test-Connection -ComputerName $IPAddress -Count 1 -ErrorAction StopWrite-Host 'Get the mac address from arp'$Mac = (% arp -a $IP.Address)Write-Host 'Regex the output of Arp to get the mac address' $MacAddress = ($mac | ? { $_ -match $IP.Address } ) -match "([0-9A-F]{2}([:-][0-9A-F]{2}){5})"if ($Matches){ try {
Last modified by Thomas Lee on 4/29/2012 1:04:35 PM
Tags:  code  powershell  system.net
NetworkAccess ENUM usingPowerShell (NetworkAccess Enumeration (System.Net))
# enum-NetworkAccess.ps1# Demonstrates the NetworkAccess enum# Thomas Lee - tfl@psp.co.uk # Get Enum values and display $enums=[enum]::GetValues([System.Net.NetworkAccess])"System.Net.NetworkAccess enum has {0} possible values" -f $enums.count$i=1$enums|%{"Value {0}: {1}" -f $i,$_.tostring();$i++}"" # Checking against a an enum value $ToCheck1 = "somethingelse"$tocheck2 = "Accept" if ($ToCh
Last modified by Thomas Lee on 10/29/2008 5:44:48 PM
Tags:  code  powershell  system.net
Sample - converted to PowerShell (WebClient Class (System.Net))
# webclient.ps1# Web client sample recoded in PowerShell# Converted from MSDN C# Sample# Thomas Lee - tfl@psp.co.uk# get a web page (author's blog)$client = new-object system.net.WebClient$client.Headers.Add("user-agent", "PowerShell")$data = $client.OpenRead("http://tfl09.blogspot.com/")$reader = new-object system.io.StreamReader $data [string] $s = $reader.ReadToEnd() # display output"The ret
Last modified by Thomas Lee on 7/30/2011 9:22:40 PM
Tags:  code  powershell  system.net
Page view tracker