Guest User

Untitled

a guest
Mar 19th, 2017
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $mac = '6c-ad-f8-b9-72-50'
  2. $gwip = Get-WmiObject -Class Win32_IP4RouteTable | where { $_.destination -eq '0.0.0.0' -and $_.mask -eq '0.0.0.0'} | select nexthop
  3. ping -n 1 $gwip.nexthop | out-null
  4. $arpIP = arp -a | select-string $mac |% { $_.ToString().Trim().Split(" ")[0] }
  5. if ($gwip.nexthop -eq $arpIP){
  6.   write-host "home"
  7. }else{
  8.   write-host "away"
  9. }
Advertisement
Add Comment
Please, Sign In to add comment