Advertisement
Guest User

Untitled

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