title: How can I replicate a RPC firewall entry using New-NetFirewallRule in Powershell?
body: <p>I'm working on a deployment script for Windows Server 2012R2 that has to replicate some firewall enrties. The New-NetFirewallRule cmdlet works fine for simple rules but I'm not able to make this custom one work through powershell :</p>
  
  <p><a href="https://i.stack.imgur.com/XS4Q2.png" rel="nofollow noreferrer">Rule I'm trying to replicate</a></p>
  
  <p>According to <a href="https://technet.microsoft.com/en-US/library/jj554908(v=wps.630).aspx" rel="nofollow noreferrer">Technet documentation</a> :</p>
  
  <blockquote>
    <p>If the Protocol parameter value is TCP or UDP, then the acceptable
    values for this parameter are:<br> 
    -- Port range: 0 through 65535.<br> 
    -- Port number: 80. <br>
    -- Keyword: PlayToDiscovery or Any.  <br><br>If the Protocol parameter value is ICMPv4 or ICMPv6, then the acceptable values for this parameter
    are: <br>
    -- An ICMP type, code pair: 0, 8. <br>
    -- Type and code: 0 through 255. <br>
    -- Keyword: Any. <br><br>If the Protocol parameter is not specified, then the acceptable values for this parameter are: RPC, RPCEPMap, Teredo,
    IPHTTPSIn, IPHTTPSOut, or Any.</p>
  </blockquote>
  
  <p>So I can't figure how to define a rule that uses Protocol=TCP and Local Port="RPC Dynamic Ports". Could anyone throw some light here? :)</p>