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