presents by IT Consulting 109

PowerShell – ファイアウォール情報を取得

概要

Get-NetFirewallProfileを使用することでファイアウォールの情報を取得することが可能です。

今回は、ファイアウォールの設定情報を取得する方法について記載しています。

 

手順

Get-NetFirewallProfile

実行結果

Name                            : Domain
Enabled                         : True
DefaultInboundAction            : NotConfigured
DefaultOutboundAction           : NotConfigured
AllowInboundRules               : NotConfigured
AllowLocalFirewallRules         : NotConfigured
AllowLocalIPsecRules            : NotConfigured
AllowUserApps                   : NotConfigured
AllowUserPorts                  : NotConfigured
AllowUnicastResponseToMulticast : NotConfigured
NotifyOnListen                  : True
EnableStealthModeForIPsec       : NotConfigured
LogFileName                     : %systemroot%\system32\LogFiles\Firewall\pfirewall.log
LogMaxSizeKilobytes             : 4096
LogAllowed                      : False
LogBlocked                      : False
LogIgnored                      : NotConfigured
DisabledInterfaceAliases        : {NotConfigured}

Name                            : Private
Enabled                         : True
DefaultInboundAction            : NotConfigured
DefaultOutboundAction           : NotConfigured
AllowInboundRules               : NotConfigured
AllowLocalFirewallRules         : NotConfigured
AllowLocalIPsecRules            : NotConfigured
AllowUserApps                   : NotConfigured
AllowUserPorts                  : NotConfigured
AllowUnicastResponseToMulticast : NotConfigured
NotifyOnListen                  : True
EnableStealthModeForIPsec       : NotConfigured
LogFileName                     : %systemroot%\system32\LogFiles\Firewall\pfirewall.log
LogMaxSizeKilobytes             : 4096
LogAllowed                      : False
LogBlocked                      : False
LogIgnored                      : NotConfigured
DisabledInterfaceAliases        : {NotConfigured}

Name                            : Public
Enabled                         : True
DefaultInboundAction            : NotConfigured
DefaultOutboundAction           : NotConfigured
AllowInboundRules               : NotConfigured
AllowLocalFirewallRules         : NotConfigured
AllowLocalIPsecRules            : NotConfigured
AllowUserApps                   : NotConfigured
AllowUserPorts                  : NotConfigured
AllowUnicastResponseToMulticast : NotConfigured
NotifyOnListen                  : True
EnableStealthModeForIPsec       : NotConfigured
LogFileName                     : %systemroot%\system32\LogFiles\Firewall\pfirewall.log
LogMaxSizeKilobytes             : 4096
LogAllowed                      : False
LogBlocked                      : False
LogIgnored                      : NotConfigured
DisabledInterfaceAliases        : {NotConfigured}

 

各項目をプロパティ画面で説明します。

Name / プロファイル
プロファイルの項目

dmain ドメイン プロファイル
private プライベート プロファイル
public パブリック プロファイル

 

Enabled / ファイアウォールの状態
ファイアウォールの状態

True 有効
False 無効

 

DefaultInboundAction / 受信接続 

NotConfigured ブロック(規定)
Block すべての接続をブロック
Allow  許可

 

DefaultOutboundAction / 送信接続

NotConfigured 許可(規定)
Block ブロック
Allow  許可

 

 

【設定のカスタマイズ】項目

AllowUnicastResponseToMulticast / ユニキャスト応答の不可

NotConfigured はい(規定)
False いいえ
True はい

 

NotifyOnListen / 通知を表示する

True はい
False いいえ

 

【ログ設定のカスタマイズ】項目

LogFileName / 名前

ログの出力先ファイルのパス

%systemroot%\system32\LogFiles\Firewall\pfirewall.log

 

LogMaxSizeKilobytes / サイズ制限
KB単位でのファイルサイズ

4096

 

LogAllowed / 正常な接続をログに記録する
はい or いいえ

Fasle いいえ(規定)
True はい

 

LogBlocked / 破棄されたパケットをログに記録する
はい or いいえ

Fasle いいえ(規定)
True はい

 

補足

以下はプロパティに紐付きが難しい項目でした。

値が「NotConfigured」となっていることから「規定」で設定されているとは思います。

AllowInboundRules : False 受信ルールを許可する
AllowLocalFirewallRules : NotConfigured ローカルファイアウォールルールを許可する
AllowLocalIPsecRules : NotConfigured ローカルIPsecルールを許可する
AllowUserApps : NotConfigured ユーザーのアプリケーションを許可する
AllowUserPorts : NotConfigured ユーザーポートを許可する
EnableStealthModeForIPsec : NotConfigured IPsecのステルスモードを有効にする
DisabledInterfaceAliases : {NotConfigured} 無効なインターフェイスエイリアス
この記事を書いた人
名前:TRUE's。 千葉県育ち、神奈川県在住のIT系フリーエンジニア。 IT系のナレッジサイトを不定期で更新中。 フォトグラファー兼エンジニアとして日々勤しんでいる。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です