既定の FTP サイト レベルの設定 <ftpServer>
概要
<siteDefaults>
要素の <ftpServer>
要素は、すべての FTP サイトの FTP 機能の既定の設定を指定します。
IIS 6.0 では、FTP サービスの設定は、Web サイトとは別のメタベース セクションに格納されていました。 IIS 7 以降では、FTP 設定は、Web サイトの設定を格納する同じ <site>
要素と <siteDefaults>
要素内の ApplicationHost.config ファイルに格納されます。 このため、<ftpServer>
要素で指定された設定は、委任することも、<location>
要素内で指定することもできません。
Note
追加の FTP 設定は ApplicationHost.config ファイルの <system.ftpServer>
セクションに格納され、これらの設定は <location>
要素内で指定されます。
互換性
バージョン | メモ |
---|---|
IIS 10.0 | <ftpServer> 要素は IIS 10.0 では変更されませんでした。 |
IIS 8.5 | <ftpServer> 要素は IIS 8.5 では変更されませんでした。 |
IIS 8.0 | <ftpServer> 要素は IIS 8.0 では変更されませんでした。 |
IIS 7.5 | <ftpServer> 要素は、IIS 7.5 の機能として付属しています。 |
IIS 7.0 | <ftpServer> 要素が、IIS 7.0 用の別個のダウンロードとして FTP 7.0 で導入されました。 |
IIS 6.0 | <ftpServer> 要素とその子要素は、LM/MSFTPSVC メタベース パスにある IIS 6.0 の FTP 設定を置き換えます。 |
Note
FTP 7.0 サービスと FTP 7.5 サービスは IIS 7.0 とは別に出荷され、次の URL からモジュールをダウンロードしてインストールする必要がありました。
Windows 7 と Windows Server 2008 R2 では、FTP 7.5 サービスは IIS 7.5 の機能として付属しているため、FTP サービスのダウンロードは必要なくなりました。
段取り
Web サーバーの FTP 公開をサポートするには、FTP サービスをインストールする必要があります。 そのためには、次のステップに従います。
Windows Server 2012 または Windows Server 2012 R2
タスク バーで [サーバー マネージャー]をクリックします。
[サーバー マネージャー] で、[管理] メニューを選択し、[役割と機能の追加] を選択します。
[役割と機能の追加] ウィザードで、[次へ] をクリックします。 インストールの種類を選択し、[次へ] をクリックします。 対象サーバーを選択し、[次へ] をクリックします。
[サーバーの役割] ページで、[Web サーバー (IIS)] を展開して、[FTP サーバー] を選びます。
Note
FTP サービスに対して ASP.NET メンバーシップ認証または IIS マネージャー認証をサポートするには、[FTP Service] に加えて[FTP 拡張] も選択する必要があります。
.
[次へ] をクリックし、[機能の選択] ページで再度 [次へ] をクリックします。
[インストール オプションの確認] ページで、[インストール] をクリックします。
[結果] ページで、 [閉じる]をクリックします。
Windows 8 または Windows 8.1
[スタート] 画面で、ポインターを左下隅まで移動し、[スタート] ボタンを右クリックし、[コントロール パネル] をクリックします。
[コントロール パネル]で [プログラムと機能] をクリックし、[Windows の機能の有効化または無効化] をクリックします。
[インターネット インフォメーション サービス] を展開し、[FTP サーバー] を展開します。
Note
FTP サービスに対して ASP.NET メンバーシップ認証または IIS マネージャー認証をサポートするには、[FTP 拡張] も選択する必要があります。
OK をクリックします。
閉じるをクリックします。
Windows Server 2008 R2
タスク バーで [スタート] をクリックし、[管理ツール] をポイントして、[サーバー マネージャ] をクリックします。
[サーバー マネージャ] 階層ウィンドウで [役割] を展開し、[Web サーバー (IIS)] をクリックします。
[Web サーバー (IIS)] ウィンドウで、[役割サービス] セクションまでスクロールし、[役割サービスの追加] をクリックします。
[役割サービスの追加] ウィザードの [役割サービスの選択] ページで [FTP サーバー] を展開します。
[FTP Service] を選択します。
Note
FTP サービスに対して ASP.NET メンバーシップ認証または IIS マネージャー認証をサポートするには、[FTP 拡張] も選択する必要があります。
次へ をクリックします。
[インストール オプションの確認] ページで、[インストール] をクリックします。
[結果] ページで、 [閉じる]をクリックします。
Windows 7
タスク バーで、[スタート]、[コントロール パネル] の順にクリックします。
[コントロール パネル]で [プログラムと機能] をクリックし、[Windows の機能の有効化または無効化] をクリックします。
[インターネット インフォメーション サービス]、[FTP サーバー] の順に展開します。
[FTP Service] を選択します。
Note
FTP サービスに対して ASP.NET メンバーシップ認証または IIS マネージャー認証をサポートするには、[FTP 拡張] も選択する必要があります。
OK をクリックします。
Windows Server 2008 または Windows Vista
次の URL からインストール パッケージをダウンロードします。
次のチュートリアルの手順に従って、FTP サービスをインストールします。
操作方法
FTP 匿名認証の既定の設定を有効または無効にする方法
次のようにインターネット インフォメーション サービス (IIS) マネージャーを開きます。
Windows Server 2012 または Windows Server 2012 R2 を使用している場合:
- タスク バーで、[サーバー マネージャー] をクリックし、[ツール]、[インターネット インフォメーション サービス (IIS) マネージャー] の順にクリックします。
Windows 8 または Windows 8.1 を使用している場合:
- Windows キーを押しながら文字 X を押し、[コントロール パネル] をクリックします。
- [管理ツール] をクリックし、[インターネット インフォメーション サービス (IIS) マネージャー] をダブルクリックします。
Windows Server 2008 または Windows Server 2008 R2 を使用している場合:
- タスク バーで、[スタート] ボタンをクリックし、[管理ツール]、[インターネット インフォメーション サービス (IIS) マネージャー] の順にクリックします。
Windows Vista または Windows 7 を使用している場合:
- タスク バーで、[スタート]、[コントロール パネル] の順にクリックします。
- [管理ツール] をダブルクリックし、[インターネット インフォメーション サービス (IIS) マネージャー] をダブルクリックします。
[接続] ウィンドウでサーバー名をクリックします。
サーバーの [ホーム] ペインで、[FTP 認証] 機能をダブルクリックします。
[FTP 認証] ページで、[匿名認証] を選びます。
[操作] ウィンドウで、[有効にする] をクリックして匿名認証を有効にするか、[無効にする] をクリックして匿名認証を無効にします。
FTP 基本認証の既定の設定を有効または無効にする方法
次のようにインターネット インフォメーション サービス (IIS) マネージャーを開きます。
Windows Server 2012 または Windows Server 2012 R2 を使用している場合:
- タスク バーで、[サーバー マネージャー] をクリックし、[ツール]、[インターネット インフォメーション サービス (IIS) マネージャー] の順にクリックします。
Windows 8 または Windows 8.1 を使用している場合:
- Windows キーを押しながら文字 X を押し、[コントロール パネル] をクリックします。
- [管理ツール] をクリックし、[インターネット インフォメーション サービス (IIS) マネージャー] をダブルクリックします。
Windows Server 2008 または Windows Server 2008 R2 を使用している場合:
- タスク バーで、[スタート] ボタンをクリックし、[管理ツール]、[インターネット インフォメーション サービス (IIS) マネージャー] の順にクリックします。
Windows Vista または Windows 7 を使用している場合:
- タスク バーで、[スタート]、[コントロール パネル] の順にクリックします。
- [管理ツール] をダブルクリックし、[インターネット インフォメーション サービス (IIS) マネージャー] をダブルクリックします。
[接続] ウィンドウでサーバー名をクリックします。
サーバーの [ホーム] ペインで、[FTP 認証] 機能をダブルクリックします。
[FTP 認証] ページで、[基本認証] を選びます。
[操作] ウィンドウで、[有効にする] をクリックして基本認証を有効にするか、[無効にする] をクリックして基本認証を無効にします。
構成
既定の <ftpServer>
要素は、<siteDefaults>
レベルで構成されます。
属性
属性 | 説明 |
---|---|
allowUTF8 |
省略可能で、 Boolean 型の属性。 UTF8 を有効にする場合は true、それ以外の場合は false。 既定値は true です。 |
serverAutoStart |
省略可能で、 Boolean 型の属性。 FTP サービスの起動時に IIS が FTP サイトを自動的に開始する必要がある場合は true、それ以外の場合は false。 既定値は true です。 |
子要素
要素 | 説明 |
---|---|
connections |
省略可能な要素です。 FTP サイトの接続固有の既定の設定を指定します。 |
security |
省略可能な要素です。 FTP サイトのセキュリティ関連の既定の設定を指定します。 |
customFeatures |
省略可能な要素です。 FTP 拡張機能を使用して開発されたカスタム FTP プロバイダーの既定のコレクションを指定します。 |
messages |
省略可能な要素です。 FTP サイトが FTP クライアントに表示する接続関連の既定のメッセージを指定します。 |
fileHandling |
省略可能な要素です。 FTP サイトの既定のファイル処理設定を指定します。 |
firewallSupport |
省略可能な要素です。 ファイアウォール経由で行われる FTP 接続に必要な FTP サイトの既定の設定を指定します。 |
userIsolation |
省略可能な要素です。 FTP 接続の既定のホーム ディレクトリ参照動作を指定します。 たとえば、ユーザーの参照対象を、ログイン名に基づくホーム ディレクトリに制限できます。 |
directoryBrowse |
省略可能な要素です。 FTP サイトの既定のディレクトリの一覧オプションを指定します。 この設定は、FTP サービスがディレクトリの一覧を FTP クライアントに表示する方法に影響します。 |
logFile |
省略可能な要素です。 FTP サイトの既定のログ オプションを指定します。 |
構成サンプル
次の構成サンプルは、FTP サイトの既定値をいくつか定義するサーバーの <siteDefaults>
要素の例を示しています。
<siteDefaults>
<logFile logFormat="W3C" directory="%SystemDrive%\inetpub\logs\LogFiles" />
<traceFailedRequestsLogging enabled="true" directory="%SystemDrive%\inetpub\logs\FailedReqLogFiles" />
<ftpServer serverAutoStart="true">
<connections controlChannelTimeout="300" />
<security>
<commandFiltering>
<add command="SYST" allowed="false" />
</commandFiltering>
<ssl serverCertHash="57686f6120447564652c2049495320526f636b73" controlChannelPolicy="SslAllow" dataChannelPolicy="SslAllow" />
<sslClientCertificates clientCertificatePolicy="CertIgnore" />
<authentication>
<anonymousAuthentication enabled="false" />
<basicAuthentication enabled="false" />
<clientCertAuthentication enabled="false" />
<customAuthentication>
<providers>
<add name="FtpCustomAuthenticationModule" enabled="false" />
</providers>
</customAuthentication>
</authentication>
</security>
<messages bannerMessage="Welcome!" allowLocalDetailedErrors="true" />
<fileHandling keepPartialUploads="false" />
<firewallSupport externalIp4Address="169.254.10.10" />
<userIsolation mode="None" />
<directoryBrowse showFlags="StyleUnix, DisplayAvailableBytes" />
<logFile period="Daily" enabled="true" />
</ftpServer>
</siteDefaults>
サンプル コード
次のコード サンプルは、FTP サイトのいくつかの既定値の設定を示しています。
AppCmd.exe
REM Configure FTP sites to start automatically by default.
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.serverAutoStart:"True" /commit:apphost
REM Configure the default control channel time-out for 300 seconds.
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.connections.controlChannelTimeout:"300" /commit:apphost
REM Configure the default FTP security options.
appcmd.exe set config -section:system.applicationHost/sites /+"siteDefaults.ftpServer.security.commandFiltering.[command='SYST',allowed='False']" /commit:apphost
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.security.ssl.controlChannelPolicy:"SslAllow" /commit:apphost
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.security.ssl.dataChannelPolicy:"SslAllow" /commit:apphost
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.security.ssl.serverCertHash:"57686f6120447564652c2049495320526f636b73" /commit:apphost
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.security.authentication.anonymousAuthentication.enabled:"False" /commit:apphost
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.security.authentication.basicAuthentication.enabled:"False" /commit:apphost
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.security.authentication.clientCertAuthentication.enabled:"False" /commit:apphost
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.security.sslClientCertificates.clientCertificatePolicy:"CertIgnore" /commit:apphost
appcmd.exe set config -section:system.applicationHost/sites /+"siteDefaults.ftpServer.security.authentication.customAuthentication.providers.[name='FtpCustomAuthenticationModule',enabled='False']" /commit:apphost
REM Configure a custom default banner message and local detailed error messages.
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.messages.bannerMessage:"Welcome!" /siteDefaults.ftpServer.messages.allowLocalDetailedErrors:"True" /commit:apphost
REM Configure the FTP service to keep partially-uploaded files by default.
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.fileHandling.keepPartialUploads:"False" /commit:apphost
REM Configure the default external IP address of a firewall.
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.firewallSupport.externalIp4Address:"169.254.10.10" /commit:apphost
REM Specify no user isolation by default.
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.userIsolation.mode:"None" /commit:apphost
REM Configure UNIX-style directory listings by default and display the available drive space.
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.directoryBrowse.showFlags:"StyleUnix, DisplayAvailableBytes" /commit:apphost
REM Enable logging by default with daily log file rollover.
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.logFile.period:"Daily" /siteDefaults.ftpServer.logFile.enabled:"True" /commit:apphost
Note
AppCmd.exe を使用してこれらの設定を構成するときは、commit パラメーターを必ず apphost
に設定する必要があります。 これで、ApplicationHost.config ファイルの適切な場所セクションに構成設定がコミットされます。
C#
using System;
using System.Text;
using Microsoft.Web.Administration;
internal static class Sample
{
private static void Main()
{
using (ServerManager serverManager = new ServerManager())
{
Configuration config = serverManager.GetApplicationHostConfiguration();
ConfigurationSection sitesSection = config.GetSection("system.applicationHost/sites");
ConfigurationElement siteDefaultsElement = sitesSection.GetChildElement("siteDefaults");
ConfigurationElement ftpServerElement = siteDefaultsElement.GetChildElement("ftpServer");
// Configure FTP sites to start automatically by default.
ftpServerElement["serverAutoStart"] = true;
// Configure the default control channel time-out for 300 seconds.
ConfigurationElement connectionsElement = ftpServerElement.GetChildElement("connections");
connectionsElement["controlChannelTimeout"] = 300;
// Configure the default FTP security options.
ConfigurationElement securityElement = ftpServerElement.GetChildElement("security");
ConfigurationElement commandFilteringElement = securityElement.GetChildElement("commandFiltering");
ConfigurationElementCollection commandFilteringCollection = commandFilteringElement.GetCollection();
ConfigurationElement addElement = commandFilteringCollection.CreateElement("add");
addElement["command"] = @"SYST";
addElement["allowed"] = false;
commandFilteringCollection.Add(addElement);
ConfigurationElement sslElement = securityElement.GetChildElement("ssl");
sslElement["controlChannelPolicy"] = @"SslAllow";
sslElement["dataChannelPolicy"] = @"SslAllow";
sslElement["serverCertHash"] = "57686f6120447564652c2049495320526f636b73";
ConfigurationElement authenticationElement = securityElement.GetChildElement("authentication");
ConfigurationElement anonymousAuthenticationElement = authenticationElement.GetChildElement("anonymousAuthentication");
anonymousAuthenticationElement["enabled"] = false;
ConfigurationElement basicAuthenticationElement = authenticationElement.GetChildElement("basicAuthentication");
basicAuthenticationElement["enabled"] = false;
ConfigurationElement clientCertAuthenticationElement = authenticationElement.GetChildElement("clientCertAuthentication");
clientCertAuthenticationElement["enabled"] = false;
ConfigurationElement sslClientCertificatesElement = securityElement.GetChildElement("sslClientCertificates");
sslClientCertificatesElement["clientCertificatePolicy"] = @"CertIgnore";
ConfigurationElement customAuthenticationElement = authenticationElement.GetChildElement("customAuthentication");
ConfigurationElementCollection providersCollection = customAuthenticationElement.GetCollection("providers");
ConfigurationElement addElement1 = providersCollection.CreateElement("add");
addElement1["name"] = @"FtpCustomAuthenticationModule";
addElement1["enabled"] = false;
providersCollection.Add(addElement1);
// Configure a custom default banner message and local detailed error messages.
ConfigurationElement messagesElement = ftpServerElement.GetChildElement("messages");
messagesElement["bannerMessage"] = @"Welcome!";
messagesElement["allowLocalDetailedErrors"] = true;
// Configure the FTP service to keep partially-uploaded files by default.
ConfigurationElement fileHandlingElement = ftpServerElement.GetChildElement("fileHandling");
fileHandlingElement["keepPartialUploads"] = false;
// Configure the default external IP address of a firewall.
ConfigurationElement firewallSupportElement = ftpServerElement.GetChildElement("firewallSupport");
firewallSupportElement["externalIp4Address"] = @"169.254.10.10";
// Specify no user isolation by default.
ConfigurationElement userIsolationElement = ftpServerElement.GetChildElement("userIsolation");
userIsolationElement["mode"] = @"None";
// Configure UNIX-style directory listings by default and display the available drive space.
ConfigurationElement directoryBrowseElement = ftpServerElement.GetChildElement("directoryBrowse");
directoryBrowseElement["showFlags"] = @"StyleUnix, DisplayAvailableBytes";
// Enable logging by default with daily log file rollover.
ConfigurationElement logFileElement = ftpServerElement.GetChildElement("logFile");
logFileElement["period"] = @"Daily";
logFileElement["enabled"] = true;
serverManager.CommitChanges();
}
}
}
VB.NET
Imports System
Imports System.Text
Imports Microsoft.Web.Administration
Module Sample
Sub Main()
Dim serverManager As ServerManager = New ServerManager
Dim config As Configuration = serverManager.GetApplicationHostConfiguration
Dim sitesSection As ConfigurationSection = config.GetSection("system.applicationHost/sites")
Dim siteDefaultsElement As ConfigurationElement = sitesSection.GetChildElement("siteDefaults")
Dim ftpServerElement As ConfigurationElement = siteDefaultsElement.GetChildElement("ftpServer")
' Configure FTP sites to start automatically by default.
ftpServerElement("serverAutoStart") = True
' Configure the default control channel time-out for 300 seconds.
Dim connectionsElement As ConfigurationElement = ftpServerElement.GetChildElement("connections")
connectionsElement("controlChannelTimeout") = 300
' Configure the default FTP security options.
Dim securityElement As ConfigurationElement = ftpServerElement.GetChildElement("security")
Dim commandFilteringElement As ConfigurationElement = securityElement.GetChildElement("commandFiltering")
Dim commandFilteringCollection As ConfigurationElementCollection = commandFilteringElement.GetCollection
Dim addElement As ConfigurationElement = commandFilteringCollection.CreateElement("add")
addElement("command") = "SYST"
addElement("allowed") = False
commandFilteringCollection.Add(addElement)
Dim sslElement As ConfigurationElement = securityElement.GetChildElement("ssl")
sslElement("controlChannelPolicy") = "SslAllow"
sslElement("dataChannelPolicy") = "SslAllow"
sslElement("serverCertHash") = "57686f6120447564652c2049495320526f636b73"
Dim authenticationElement As ConfigurationElement = securityElement.GetChildElement("authentication")
Dim anonymousAuthenticationElement As ConfigurationElement = authenticationElement.GetChildElement("anonymousAuthentication")
anonymousAuthenticationElement("enabled") = False
Dim basicAuthenticationElement As ConfigurationElement = authenticationElement.GetChildElement("basicAuthentication")
basicAuthenticationElement("enabled") = False
Dim clientCertAuthenticationElement As ConfigurationElement = authenticationElement.GetChildElement("clientCertAuthentication")
clientCertAuthenticationElement("enabled") = False
Dim sslClientCertificatesElement As ConfigurationElement = securityElement.GetChildElement("sslClientCertificates")
sslClientCertificatesElement("clientCertificatePolicy") = "CertIgnore"
Dim customAuthenticationElement As ConfigurationElement = authenticationElement.GetChildElement("customAuthentication")
Dim providersCollection As ConfigurationElementCollection = customAuthenticationElement.GetCollection("providers")
Dim addElement1 As ConfigurationElement = providersCollection.CreateElement("add")
addElement1("name") = "FtpCustomAuthenticationModule"
addElement1("enabled") = False
providersCollection.Add(addElement1)
' Configure a custom default banner message and local detailed error messages.
Dim messagesElement As ConfigurationElement = ftpServerElement.GetChildElement("messages")
messagesElement("bannerMessage") = "Welcome!"
messagesElement("allowLocalDetailedErrors") = True
' Configure the FTP service to keep partially-uploaded files by default.
Dim fileHandlingElement As ConfigurationElement = ftpServerElement.GetChildElement("fileHandling")
fileHandlingElement("keepPartialUploads") = False
' Configure the default external IP address of a firewall.
Dim firewallSupportElement As ConfigurationElement = ftpServerElement.GetChildElement("firewallSupport")
firewallSupportElement("externalIp4Address") = "169.254.10.10"
' Specify no user isolation by default.
Dim userIsolationElement As ConfigurationElement = ftpServerElement.GetChildElement("userIsolation")
userIsolationElement("mode") = "None"
' Configure UNIX-style directory listings by default and display the available drive space.
Dim directoryBrowseElement As ConfigurationElement = ftpServerElement.GetChildElement("directoryBrowse")
directoryBrowseElement("showFlags") = "StyleUnix, DisplayAvailableBytes"
' Enable logging by default with daily log file rollover.
Dim logFileElement As ConfigurationElement = ftpServerElement.GetChildElement("logFile")
logFileElement("period") = "Daily"
logFileElement("enabled") = True
serverManager.CommitChanges()
End Sub
End Module
JavaScript
var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
var sitesSection = adminManager.GetAdminSection("system.applicationHost/sites", "MACHINE/WEBROOT/APPHOST");
var siteDefaultsElement = sitesSection.ChildElements.Item("siteDefaults");
var ftpServerElement = siteDefaultsElement.ChildElements.Item("ftpServer");
// Configure FTP sites to start automatically by default.
ftpServerElement.Properties.Item("serverAutoStart").Value = true;
// Configure the default control channel time-out for 300 seconds.
var connectionsElement = ftpServerElement.ChildElements.Item("connections");
connectionsElement.Properties.Item("controlChannelTimeout").Value = 300;
// Configure the default FTP security options.
var securityElement = ftpServerElement.ChildElements.Item("security");
var commandFilteringElement = securityElement.ChildElements.Item("commandFiltering");
var commandFilteringCollection = commandFilteringElement.Collection;
var addElement = commandFilteringCollection.CreateNewElement("add");
addElement.Properties.Item("command").Value = "SYST";
addElement.Properties.Item("allowed").Value = false;
commandFilteringCollection.AddElement(addElement);
var sslElement = securityElement.ChildElements.Item("ssl");
sslElement.Properties.Item("controlChannelPolicy").Value = "SslAllow";
sslElement.Properties.Item("dataChannelPolicy").Value = "SslAllow";
sslElement.Properties.Item("serverCertHash").Value = "57686f6120447564652c2049495320526f636b73";
var authenticationElement = securityElement.ChildElements.Item("authentication");
var anonymousAuthenticationElement = authenticationElement.ChildElements.Item("anonymousAuthentication");
anonymousAuthenticationElement.Properties.Item("enabled").Value = false;
var basicAuthenticationElement = authenticationElement.ChildElements.Item("basicAuthentication");
basicAuthenticationElement.Properties.Item("enabled").Value = false;
var clientCertAuthenticationElement = authenticationElement.ChildElements.Item("clientCertAuthentication");
clientCertAuthenticationElement.Properties.Item("enabled").Value = false;
var sslClientCertificatesElement = securityElement.ChildElements.Item("sslClientCertificates");
sslClientCertificatesElement.Properties.Item("clientCertificatePolicy").Value = "CertIgnore";
var customAuthenticationElement = authenticationElement.ChildElements.Item("customAuthentication");
var providersCollection = customAuthenticationElement.ChildElements.Item("providers").Collection;
var addElement1 = providersCollection.CreateNewElement("add");
addElement1.Properties.Item("name").Value = "FtpCustomAuthenticationModule";
addElement1.Properties.Item("enabled").Value = false;
providersCollection.AddElement(addElement1);
// Configure a custom default banner message and local detailed error messages.
var messagesElement = ftpServerElement.ChildElements.Item("messages");
messagesElement.Properties.Item("bannerMessage").Value = "Welcome!";
messagesElement.Properties.Item("allowLocalDetailedErrors").Value = true;
// Configure the FTP service to keep partially-uploaded files by default.
var fileHandlingElement = ftpServerElement.ChildElements.Item("fileHandling");
fileHandlingElement.Properties.Item("keepPartialUploads").Value = false;
// Configure the default external IP address of a firewall.
var firewallSupportElement = ftpServerElement.ChildElements.Item("firewallSupport");
firewallSupportElement.Properties.Item("externalIp4Address").Value = "169.254.10.10";
// Specify no user isolation by default.
var userIsolationElement = ftpServerElement.ChildElements.Item("userIsolation");
userIsolationElement.Properties.Item("mode").Value = "None";
// Configure UNIX-style directory listings by default and display the available drive space.
var directoryBrowseElement = ftpServerElement.ChildElements.Item("directoryBrowse");
directoryBrowseElement.Properties.Item("showFlags").Value = "StyleUnix, DisplayAvailableBytes";
// Enable logging by default with daily log file rollover.
var logFileElement = ftpServerElement.ChildElements.Item("logFile");
logFileElement.Properties.Item("period").Value = "Daily";
logFileElement.Properties.Item("enabled").Value = true;
adminManager.CommitChanges();
VBScript
Set adminManager = createObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"
Set sitesSection = adminManager.GetAdminSection("system.applicationHost/sites", "MACHINE/WEBROOT/APPHOST")
Set siteDefaultsElement = sitesSection.ChildElements.Item("siteDefaults")
Set ftpServerElement = siteDefaultsElement.ChildElements.Item("ftpServer")
' Configure FTP sites to start automatically by default.
ftpServerElement.Properties.Item("serverAutoStart").Value = True
' Configure the default control channel time-out for 300 seconds.
Set connectionsElement = ftpServerElement.ChildElements.Item("connections")
connectionsElement.Properties.Item("controlChannelTimeout").Value = 300
' Configure the default FTP security options.
Set securityElement = ftpServerElement.ChildElements.Item("security")
Set commandFilteringElement = securityElement.ChildElements.Item("commandFiltering")
Set commandFilteringCollection = commandFilteringElement.Collection
Set addElement = commandFilteringCollection.CreateNewElement("add")
addElement.Properties.Item("command").Value = "SYST"
addElement.Properties.Item("allowed").Value = False
commandFilteringCollection.AddElement(addElement)
Set sslElement = securityElement.ChildElements.Item("ssl")
sslElement.Properties.Item("controlChannelPolicy").Value = "SslAllow"
sslElement.Properties.Item("dataChannelPolicy").Value = "SslAllow"
sslElement.Properties.Item("serverCertHash").Value = "57686f6120447564652c2049495320526f636b73"
Set authenticationElement = securityElement.ChildElements.Item("authentication")
Set anonymousAuthenticationElement = authenticationElement.ChildElements.Item("anonymousAuthentication")
anonymousAuthenticationElement.Properties.Item("enabled").Value = False
Set basicAuthenticationElement = authenticationElement.ChildElements.Item("basicAuthentication")
basicAuthenticationElement.Properties.Item("enabled").Value = False
Set clientCertAuthenticationElement = authenticationElement.ChildElements.Item("clientCertAuthentication")
clientCertAuthenticationElement.Properties.Item("enabled").Value = False
Set sslClientCertificatesElement = securityElement.ChildElements.Item("sslClientCertificates")
sslClientCertificatesElement.Properties.Item("clientCertificatePolicy").Value = "CertIgnore"
Set customAuthenticationElement = authenticationElement.ChildElements.Item("customAuthentication")
Set providersCollection = customAuthenticationElement.ChildElements.Item("providers").Collection
Set addElement1 = providersCollection.CreateNewElement("add")
addElement1.Properties.Item("name").Value = "FtpCustomAuthenticationModule"
addElement1.Properties.Item("enabled").Value = False
providersCollection.AddElement(addElement1)
' Configure a custom default banner message and local detailed error messages.
Set messagesElement = ftpServerElement.ChildElements.Item("messages")
messagesElement.Properties.Item("bannerMessage").Value = "Welcome!"
messagesElement.Properties.Item("allowLocalDetailedErrors").Value = True
' Configure the FTP service to keep partially-uploaded files by default.
Set fileHandlingElement = ftpServerElement.ChildElements.Item("fileHandling")
fileHandlingElement.Properties.Item("keepPartialUploads").Value = False
' Configure the default external IP address of a firewall.
Set firewallSupportElement = ftpServerElement.ChildElements.Item("firewallSupport")
firewallSupportElement.Properties.Item("externalIp4Address").Value = "169.254.10.10"
' Specify no user isolation by default.
Set userIsolationElement = ftpServerElement.ChildElements.Item("userIsolation")
userIsolationElement.Properties.Item("mode").Value = "None"
' Configure UNIX-style directory listings by default and display the available drive space.
Set directoryBrowseElement = ftpServerElement.ChildElements.Item("directoryBrowse")
directoryBrowseElement.Properties.Item("showFlags").Value = "StyleUnix, DisplayAvailableBytes"
' Enable logging by default with daily log file rollover.
Set logFileElement = ftpServerElement.ChildElements.Item("logFile")
logFileElement.Properties.Item("period").Value = "Daily"
logFileElement.Properties.Item("enabled").Value = True
adminManager.CommitChanges()