Files
CPXV2/FTP/SetFTP.ps1
2024-07-26 18:13:26 +09:00

24 lines
987 B
PowerShell

$FTPSiteName='CPXV2_FTP'
$FTPRootDir='D:\FTP'
$FTPPort='2121'
New-WebFtpSite -Name $FTPSiteName -Port $FTPPort -PhysicalPath $FTPRootDir
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.applicationHost/sites/site[@name='CPXV2_FTP']/ftpServer/security/authentication/anonymousAuthentication" -name "enabled" -value "True"
$FTPSitePath = "IIS:\Sites\$FTPSiteName"
$BasicAuth = 'ftpServer.security.authentication.basicAuthentication.enabled'
Set-ItemProperty -Path $FTPSitePath -Name $BasicAuth -Value $True
$Param = @{
Filter = "/system.ftpServer/security/authorization"
Value = @{
accessType = "Allow"
users = "*"
permissions = 3
}
PSPath = 'IIS:\'
Location = $FTPSiteName
}
Add-WebConfiguration @param
Set-ItemProperty -Path $FTPSitePath -Name 'ftpServer.security.ssl.controlChannelPolicy' -Value $false
Set-ItemProperty -Path $FTPSitePath -Name 'ftpServer.security.ssl.dataChannelPolicy' -Value $false