Set-NetFirewallRule –DisplayName "[ルール名]" -Enabled True
Set-NetFirewallRule –DisplayName "[ルール名]" -Enabled False
Remove-NetFirewallRule –DisplayName "[ルール名]"
New-NetFirewallRule ` -Name 'ICMPv4' ` -DisplayName 'ICMPv4' ` -Description 'Allow ICMPv4' ` -Profile Any ` -Direction Inbound ` -Action Allow ` -Protocol ICMPv4 ` -Program Any ` -LocalAddress Any ` -RemoteAddress Any
Get-NetFirewallRule | Where-Object Name -Like 'ICMPv4' Name : ICMPv4 DisplayName : ICMPv4 Description : Allow ICMPv4 DisplayGroup : Group : Enabled : True Profile : Any Platform : {} Direction : Inbound Action : Allow EdgeTraversalPolicy : Block LooseSourceMapping : False LocalOnlyMapping : False Owner : PrimaryStatus : OK Status : The rule was parsed successfully from the store. (65536) EnforcementStatus : NotApplicable PolicyStoreSource : PersistentStore PolicyStoreSourceType : Local
PS> Get-NetConnectionProfile Name : XXXXXXXXXX ← このプロファイルの名前 InterfaceAlias : Wi-Fi InterfaceIndex : 20 ← このプロファイルの番号 NetworkCategory : Private ← ネットワークの場所 IPv4Connectivity : Internet IPv6Connectivity : NoTraffic
PS> Set-NetConnectionProfile -InterfaceIndex 20 -NetworkCategory Public