在 Azure Windows 服务器上的 IIS 中自动设置被动 FTP?

Automate setting up Passive FTP in IIS on Azure Windows Server?

有没有办法在 Windows 服务器上的 IIS 中自动设置 FTP 站点?我可以在 this document. 之后手动执行此操作,但我想使用脚本来执行此操作。

我在 Azure VM 运行 Windows Server 2016 上使用 IIS 10。

要设置 FTP 外部防火墙 IP 地址和数据通道端口范围,您可以应用此脚本:

#Set up data channel
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST'  -filter "system.ftpServer/firewallSupport" -name "lowDataChannelPort" -value 5000
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST'  -filter "system.ftpServer/firewallSupport" -name "highDataChannelPort" -value 6000


#Set external firewall support
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST'  -filter "system.applicationHost/sites/siteDefaults/ftpServer/firewallSupport" -name "externalIp4Address" -value "1.1.1.1"

关于如何使用 powershell 建立 FTP 站点的内容有很多 link。 https://gallery.technet.microsoft.com/scriptcenter/Creating-FTP-in-IIS-and-014b8940

您可以根据需要组合这些脚本。