WINDOWS查看FTP端口号脚本
# 获取IIS FTP服务数据通道端口范围配置
$ftpConfig = Get-WebConfigurationProperty -PSPath 'IIS:\' -Filter "system.ftpServer/firewallSupport" -Name "*"
$lowPort = $ftpConfig.lowDataChannelPort
$highPort = $ftpConfig.highDataChannelPort
if ($lowPort -and $highPort) {
Write-Output "FTP数据通道端口范围: $lowPort-$highPort"
} else {
Write-Output "未配置显式端口范围,FTP服务使用动态端口"
}