是否有一种方法可以在Windows Server的IIS中自动设置FTP站点?我可以在this document.之后手动执行此操作,但是我想使用脚本来执行此操作。
我正在运行Windows Server 2016的Azure VM上使用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站点有大量链接。https://gallery.technet.microsoft.com/scriptcenter/Creating-FTP-in-IIS-and-014b8940
您可以根据需要组合这些脚本。