Skip to content

Commit 7a3316d

Browse files
committed
Update file
1 parent 284f274 commit 7a3316d

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

docs/.vuepress/public/alist-manager.ps1

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,23 @@ function Get-LatestVersion {
6464
}
6565
}
6666

67+
# -----------------------------
68+
# 获取真实物理网卡 IPv4
6769
function Get-LocalIP {
68-
$ip = (Get-NetIPAddress -AddressFamily IPv4 |
69-
Where-Object {$_.IPAddress -ne "127.0.0.1" -and $_.IPAddress -notlike "169.*"} |
70-
Select-Object -First 1 -ExpandProperty IPAddress)
70+
$realNICs = Get-NetIPAddress -AddressFamily IPv4 | Where-Object {
71+
$_.IPAddress -ne "127.0.0.1" -and
72+
$_.IPAddress -notlike "169.*" -and
73+
$_.InterfaceAlias -notmatch "vEthernet|Virtual|VMware|Loopback|WSL|Hyper-V" -and
74+
$_.ValidLifetime -ne "Infinite"
75+
}
76+
77+
$ip = $realNICs | Sort-Object InterfaceMetric | Select-Object -First 1 -ExpandProperty IPAddress
78+
7179
if (-not $ip) { $ip = "127.0.0.1" }
7280
return $ip
7381
}
7482

83+
# -----------------------------
7584
function Install-NSSM {
7685
if (-Not (Test-Path $nssmPath)) {
7786
$tmpZip = "$env:TEMP\nssm.zip"

0 commit comments

Comments
 (0)