リモートデスクトップ接続を有効にするには、主に以下の2つの設定が必要です。
リモートデスクトップの有効化: リモートデスクトップサービス自体を有効にします。
ファイアウォールの例外設定: リモートデスクトップ接続に使用されるポート(通常TCP 3389)をWindows Firewallで許可します。
リモートデスクトップ設定の追加方法
リモートデスクトップの有効化 (TerminalServices-LocalSessionManager)
この設定は、Microsoft-Windows-TerminalServices-LocalSessionManager コンポーネントで行います。
<Components>
<Settings pass="oobeSystem">
<component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<fDenyTSConnections>false</fDenyTSConnections> </component>
</Settings>
</Components>
fDenyTSConnections:
false: リモートデスクトップ接続を許可します。
true: リモートデスクトップ接続を拒否します(デフォルト)。
Windows Firewallの例外設定 (Firewall-AdvancedSecurity)
リモートデスクトップ接続を許可するには、Windows FirewallでTCPポート3389を
許可する必要があります。これは Microsoft-Windows-Firewall-AdvancedSecurity コンポーネントで行います。
<Components>
<Settings pass="oobeSystem">
<component name="Microsoft-Windows-Firewall-AdvancedSecurity" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<FirewallRules>
<FirewallRule wcm:action="add" Name="Remote Desktop (TCP-In)" Description="Allows incoming Remote Desktop connections." Group="Remote Desktop" Protocol="6" Profile="All" InterfaceTypes="All" Dir="In" Enabled="true" LocalPort="3389" />
</FirewallRules>
</component>
</Settings>
</Components>
FirewallRule: 新しいファイアウォールルールを定義します。
Name: ルールの表示名。
Description: ルールの説明。
Group: ルールが属するグループ。
Protocol: プロトコルタイプ (6はTCP)。
Profile: 適用するネットワークプロファイル (Domain, Private, Public, All)。Allが最も包括的です。
InterfaceTypes: 適用するインターフェースの種類。Allが最も包括的です。
Dir: トラフィックの方向 (Inは受信)。
Enabled: ルールを有効にするか (trueで有効)。
LocalPort: 許可するポート番号 (3389はリモートデスクトップの標準ポート)。
このコンポーネントも、既存の応答ファイルにない場合は、上記のXMLスニペットを
<Settings pass="oobeSystem"> タグ内に新しい <component> ブロックとして追加してください。
1例ですが、こんな感じになります。
<Components>
<component name="Microsoft-Windows-TCPIP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<IPAddress wcm:action="add" wcm:keyValue="1">192.168.1.100</IPAddress>
<component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<component name="Microsoft-Windows-Firewall-AdvancedSecurity" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<FirewallRule wcm:action="add" Name="Remote Desktop (TCP-In)" Description="Allows incoming Remote Desktop connections." Group="Remote Desktop" Protocol="6" Profile="All" InterfaceTypes="All" Dir="In" Enabled="true" LocalPort="3389" />