Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- param($switch, $username, $password)
- $ip = (Test-Connection -ComputerName (hostname) -Count 1 | Select IPV4Address).IPV4Address.IPAddressToString
- [string]$output = plink -ssh $switch -l $username -pw $password "sh ip arp $ip"
- $output -match '([0-9]|[a-z]){4}\.([0-9]|[a-z]){4}\.([0-9]|[a-z]){4}'
- $mac = $matches[0]
- [string]$output = plink -ssh $switch -l $username -pw $password "sh mac address-table address $mac"
- $output -match '\w{2}\d\/(\d\/\d|\d)'
- Write-Host $matches[0]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement