Skip to content

Instantly share code, notes, and snippets.

@robsonalves
Created May 12, 2017 13:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robsonalves/3833e43c1657e5120a824c215941b52a to your computer and use it in GitHub Desktop.
Save robsonalves/3833e43c1657e5120a824c215941b52a to your computer and use it in GitHub Desktop.
Config FTP windows server via PS
Import-module servermanager
Add-WindowsFeature web-server –includeallsubfeature
Import-Module WebAdministration
New-WebFtpSite -Name "LinxFTP" -Port "21" -Force
cmd /c \Windows\System32\inetsrv\appcmd set SITE "LinxFTP" "-virtualDirectoryDefaults.physicalPath:C:\inetpub\ftproot"
Set-ItemProperty "IIS:\Sites\LinxFTP" -Name ftpServer.security.ssl.controlChannelPolicy -Value 0
Set-ItemProperty "IIS:\Sites\LinxFTP" -Name ftpServer.security.ssl.dataChannelPolicy -Value 0
Set-ItemProperty "IIS:\Sites\LinxFTP" -Name ftpServer.security.authentication.basicAuthentication.enabled -Value $true
Set-ItemProperty "IIS:\Sites\LinxFTP" -Name ftpserver.userisolation.mode -Value 3
Add-WebConfiguration "/system.ftpServer/security/authorization" -value @{accessType="Allow";roles="";permissions="Read,Write";users="*"} -PSPath IIS:\ -location "LinxFTP"
New-NetFirewallRule -DisplayName "FTP In" -Direction Inbound -Protocol TCP –Enabled True –Action Allow -Profile Any -Program "%SystemRoot%\System32\ftp.exe" -Service Any -LocalPort 20,21,1024-65535 -EdgeTraversalPolicy Allow
Restart-WebItem "IIS:\Sites\LinxFTP"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment