-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDetectDuplicateIpAddr.ps1
More file actions
45 lines (32 loc) · 1.21 KB
/
DetectDuplicateIpAddr.ps1
File metadata and controls
45 lines (32 loc) · 1.21 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
Write-Host "Detecting duplicate IP addresses on the node..."
$BaseDir = "c:\k\debug"
Write-Host "Trying to load HNS module..."
ipmo $BaseDir\hns.v2.psm1 -Force | Write-Host
while($true){
$ipAddresses = ((Get-HnsEndpoint).IpConfigurations).IpAddress
Write-Host "IP addresses on the node:"
foreach($ip in $ipAddresses){
Write-Host $ip
}
Write-Host "Checking for duplicate IP addresses inside the loop..."
$duplicateIpAddr = $ipAddresses | Group-Object | Where-Object { $_.Count -gt 1 }
if($duplicateIpAddr.Count -gt 0){
break
}
Start-Sleep -Seconds 300
}
Write-Host "Duplicate IP addresses found on the node, Duplicate IP addresses are:"
foreach($ipGroup in $duplicateIpAddr){
foreach($ip in $ipGroup.Group){
Write-Host $ip
}
}
Write-Host "Collecting Windows logs..."
$collectWindowsLogs = "$BaseDir\collect-windows-logs.ps1"
powershell $collectWindowsLogs | Write-Host
Write-Host "Collected Windows logs are at $PWD"
Write-Host "Issue has been detected, going into infinite loop to keep the container running..."
while($true){
Write-Host "Container is running in infinte while..."
Start-Sleep -Seconds 3600
}