search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
Creating a New Web FTP Site on IIS7.5 with Powershell
Posted in Hosting & IIS7, Windows Powershell, Windows Server | 2 Comments | 25,750 views | 27/02/2010 16:18

It’s really easy to create new ftp web site on IIS7.5 with Powershell WebAdministration module.

Import-Module WebAdministration
New-Item IIS:\Sites\"Default FTP Site"\$FTPUserDir\$FTPUsername -Type VirtualDirectory -PhysicalPath "$LogDir"</dir>

$FTPUserDir is the name of the Virtual Directory name. You should use “LocalUser” for standalone machines.


Comments (2)

Derek Jones

April 1st, 2012
04:16:22

Few questions..
“Import-Module Webadministration” this shouldn’t be required if all the IIS/FTP roles are installed, is that correct?

Also, I’m assuming I need to previously declare the variables:$FTPUserDir, $FTPUsername, $LogDir?

Finally, how to I specify the bindings, SSL setting, and authentication for the FTP in Powershell?

Sorry, if these are stupid questions, kind of a Powershell newbie.


admin

April 3rd, 2012
19:48:07

Hello Derek,

You need to use “Import-Module” unless you don’t use PowerShell v3. In Powershell v2, you need to import a module if you want to use it in that Powershell session. But that changed in Powershell v3 because it has autoloading module feature.

You may need to install “IIS Management Scripts” in IIS role to use WebAdministration.

Yes, you need to declare that variables. Also you can make this as function like:

function create-ftpsite
{
param ($FTPUsername, $FTPUserDir, $LogDir)

New-Item IIS:\Sites\”Default FTP Site”\$FTPUserDir\$FTPUsername -Type VirtualDirectory -PhysicalPath “$LogDir”
}

So simply you can use:

create-ftpsite -ftpusername “yusufozturk” -FTPUserdir “yusufozturk” -Logdir “C:\ftp\logs”

Hope this helps.

Yusuf.



Leave a Reply