2017-02-24 3 views
1

次のDSCステートメントは、既存のWindowsファイアウォールルールを複製します。私は重複の代わりにそれを更新することをお勧めします。おかげDSCリソースでICMPを有効にするxFirewallで新しいルールが作成される

xFirewall EnableV4PingIn{ 
    Name = 'File and Printer Sharing (Echo Request - ICMPv4-In)' 
    Group= 'File and Printer Sharing' 
    Protocol = 'ICMPv4' 
    Ensure='Present' 
    Enabled='True' 
    Direction='Inbound' 
    PsDscRunAsCredential = $DomainAdminCredential 

} 
xFirewall EnableV4PingOut{ 
    Name = 'File and Printer Sharing (Echo Request - ICMPv4-Out)' 
    Group= 'File and Printer Sharing' 
    Protocol = 'ICMPv4' 
    Ensure='Present' 
    Enabled='True' 
    Direction='Outbound' 
    PsDscRunAsCredential = $DomainAdminCredential 
} 

xFirewall EnableV6PingIn{ 
    Name = 'File and Printer Sharing (Echo Request - ICMPv6-In)' 
    Group= 'File and Printer Sharing' 
    Protocol = 'ICMPv6' 
    Ensure='Present' 
    Enabled='True' 
    Direction='Inbound' 
    PsDscRunAsCredential = $DomainAdminCredential 

} 
xFirewall EnableV6PingOut{ 
    Name = 'File and Printer Sharing (Echo Request - ICMPv6-Out)' 
    Group= 'File and Printer Sharing' 
    Protocol = 'ICMPv6' 
    Ensure='Present' 
    Enabled='True' 
    Direction='Outbound' 
    PsDscRunAsCredential = $DomainAdminCredential 
} 
+0

これでdupsを防ぐ方法を見つけましたか?私は同じ問題を抱えています... –

答えて

0

は、私はそれを考え出した:)

をそれはxFirewallの「名前」は、WindowsファイアウォールのためのGUIに示す「名前」にマップされないことが判明します。あなたが利用できるルール(と彼らの本当の「名前」)を参照するには、以下のコマンドを実行することができます

Get-NetFirewallRule |ft 

だから、あなた以上は(V4用)は、次のように簡略化することができます。

xFirewall EnableV4PingIn 
{ 
    Name = "FPS-ICMP4-ERQ-In" 
    Enabled = "True" 
} 

xFirewall EnableV4PingOut 
{ 
    Name = "FPS-ICMP4-ERQ-Out" 
    Enabled = "True" 
} 
関連する問題