Posted in
Hosting & IIS7,
Windows Powershell |
No Comment | 15,507 views | 11/12/2010 01:28
Detailed script about how to create IIS7 ftp site with Powershell.
1
2
3
4
5
6
7
8
9
10
| Function Create-FTPSite
{
Param ($FTPUsername, $LogDir, $FTPQuota, $FTPUserDir)
$FTPUserPath = ($FTPUsername.Split("\")[1])
New-Item IIS:\Sites\".Default FTP Site"\$FTPUserDir\$FTPUserPath -Type VirtualDirectory -PhysicalPath "$LogDir"
Add-WebConfiguration -Filter /System.FtpServer/Security/Authorization -Value (@{AccessType="Allow"; Users="$FTPUserPath"; Permissions="Read, Write"}) -PSPath IIS: -Location ".Default FTP Site/$FTPUserDir/$FTPUserPath"
Clear-WebConfiguration -Filter /System.FtpServer/Security/Authorization -PSPath IIS: -Location ".Default FTP Site/$FTPUserDir"
DirQuota Quota Add /Path:"$LogDir" /Limit:$FTPQuota
} |
Function Create-FTPSite
{
Param ($FTPUsername, $LogDir, $FTPQuota, $FTPUserDir)
$FTPUserPath = ($FTPUsername.Split("\")[1])
New-Item IIS:\Sites\".Default FTP Site"\$FTPUserDir\$FTPUserPath -Type VirtualDirectory -PhysicalPath "$LogDir"
Add-WebConfiguration -Filter /System.FtpServer/Security/Authorization -Value (@{AccessType="Allow"; Users="$FTPUserPath"; Permissions="Read, Write"}) -PSPath IIS: -Location ".Default FTP Site/$FTPUserDir/$FTPUserPath"
Clear-WebConfiguration -Filter /System.FtpServer/Security/Authorization -PSPath IIS: -Location ".Default FTP Site/$FTPUserDir"
DirQuota Quota Add /Path:"$LogDir" /Limit:$FTPQuota
}
DirQuota command comes with File Services feature in Windows Server 2008 to limit directories.