-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAkamaiChecks.ps1
More file actions
174 lines (134 loc) · 6.1 KB
/
AkamaiChecks.ps1
File metadata and controls
174 lines (134 loc) · 6.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
$timestamp = Get-Date -Format o | ForEach-Object { $_ -replace ":", "." }
# Collect these files from user Machine
$file = "c:\windows\logs\ETP_client.log"
$exists = Test-Path -Path $file -PathType Leaf
$servers = @()
if($exists)
{
Write-Output "###################################" | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
Write-Output " Collecting ETP Log " | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
Write-Output "###################################" | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
$etplog = Get-Content -Path $file
Write-Output $etplog | Out-File -FilePath .\ProblemLog-$timestamp.txt -Append
Write-Output "###################################" | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
Write-Output " Collecting ETP Log Summary " | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
Write-Output "###################################" | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
$regex = 'attempting to send data to'
$errors = 'DNS_ERROR'
$akamaiServers = @()
foreach($line in $etplog) {
if($line -match $errors){
Write-Output $line | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
}
if($line -match $regex){
# Work here
$array = $line.Split(" ")
#Write-Output $line | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
$newserver = $array | Select-Object -Last 1
#Write-Output $server
if($newserver -ne $server)
{
$d = $array[0]
$t = $array[1]
$server = $newserver
if(-Not ($akamaiServers -contains $server)){
$akamaiServers += $server
}
Write-Output "$d $t | Akamai Server Change Detected: $server" | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
}
}
}
foreach($server in $akamaiServers){
$array = $server.Split("%")
$servers += $array[0]
}
Write-Output $servers
}
# Collect these files from user Machine Manually
$file = "c:\windows\logs\EtpClientDiagnostics"
$exists = Test-Path -Path $file -PathType Leaf
if($exists)
{
Write-Output "###################################" | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
Write-Output " Collecting ETP Diagnostic Log " | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
Write-Output "###################################" | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
$etplog = Get-Content -Path $file
Write-Output $etplog | Out-File -FilePath .\ProblemLog-$timestamp.txt -Append
}
Write-Output "###################################" | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
Write-Output " Starting Network Diagnostic Log " | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
Write-Output "###################################" | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
Write-Output $timestamp | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
# Check DNS Queries to these.
$nslookups = @(
"sip.pstnhub.microsoft.com",
"google.com",
"facebook.com",
"apple.com"
)
# Check Connectivity to these.
$pings = @("google.com",
"4.2.2.2",
"8.8.8.8")
# Add the Akamai Servers our Client is using to the Connectivity Checks
if($servers.count -gt 0){
$pings += $servers
}
$systemtime = systeminfo | findstr /C:“Time Zone”
Write-Output $systemtime | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
while(1){
$date = Get-Date
# Record Date and Time
Write-Output $date | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
# IP Configuration
ipconfig /all | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
# Wifi Diagnostics
netsh wlan show interface | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
# DNS Checks
ForEach ($nslookup in $nslookups) {
# Use Default DNS Server
Write-Output "nslookup $nslookup"
$result = nslookup $nslookup
$result | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
# Use Static External DNS Server
Write-Output "nslookup $nslookup 1.1.1.1"
$result = nslookup $nslookup 1.1.1.1
$result | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
# Use Static External DNS Server
Write-Output "nslookup $nslookup 8.8.8.8"
$result = nslookup $nslookup 8.8.8.8
$result | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
}
$akamai = @("identity.answerx-liveness.net",
"whoami.ipv4.akahelp.com",
"www.espn.com")
# Akamai Checks
ForEach ($check in $akamai) {
$date = Get-Date
# Record Time
Write-Output $date | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
Write-Output "nslookup -type=TXT $check 23.216.52.11"
$result = nslookup -type=TXT $check 23.216.52.11
$result | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
Write-Output "nslookup -type=TXT $check 23.216.53.11"
$result = nslookup -type=TXT $check 23.216.53.11
$result | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
Write-Output "nslookup -type=TXT $check"
$result = nslookup -type=TXT $check
$result | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
}
# IPv4 Internet Reachablity Checks
ForEach ($ping in $pings) {
Write-Output "ping $ping"
$result = ping $ping
$result |Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
Write-Output "tracert $ping"
$result = tracert $ping
$result |Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
}
# Netstat Checks
$result = netstat -a -o
#$result = netstat -a -o -b # Requires Elevation
$result | Tee-Object -FilePath .\ProblemLog-$timestamp.txt -Append
Start-Sleep -s 5
}