forked from caliskanfurkan/WinLogsZero2Hero
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathARP Table to Event
10 lines (10 loc) · 900 Bytes
/
ARP Table to Event
1
2
3
4
5
6
7
8
9
10
if([System.Diagnostics.EventLog]::SourceExists("ARP Status Script")){
$x = Get-NetIPInterface | where-object {$_.ConnectionState -eq "Connected" -and $_.InterfaceAlias -notlike "*VMware*" -and $_.InterfaceAlias -notlike "*Loopback*"} | get-netneighbor | select-object -property InterfaceAlias,LinkLayerAddress,IPAddress
$x = [system.String]::Join("`r`n", $x)
write-eventlog -logname "System" -source "ARP Status Script" -message $x -EventId 10001
}Else{
$x = Get-NetIPInterface | where-object {$_.ConnectionState -eq "Connected" -and $_.InterfaceAlias -notlike "*VMware*" -and $_.InterfaceAlias -notlike "*Loopback*"} | get-netneighbor | select-object -property InterfaceAlias,LinkLayerAddress,IPAddress
$x = [system.String]::Join("`r`n", $x)
New-EventLog –LogName "System" –Source “ARP Status Script”
write-eventlog -logname "System" -source "ARP Status Script" -message $x -EventId 10001
}