> For the complete documentation index, see [llms.txt](https://docs.plura.io/ja/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.plura.io/ja/faq/siem/logging/powershell.md).

# Powershell スクリプトブロックロギングオン

### 1.  PowerShell スクリプトブロックロギングオン <a href="#id-1" id="id-1"></a>

### 2. Powershell Command <a href="#id-2" id="id-2"></a>

2-1. Powershell バージョン確認

`$PSVersionTable.PSVersion.Major`

2-2. Windows OS バージョン確認

`Get-WmiObject Win32_OperatingSystem | Select -Property Name`

2-3. PowerShell スクリプトブロックロギングオン “使用” (管理者権限で実行)

`reg add “HKLM\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging” /v “EnableScriptBlockLogging” /t REG_DWORD /d 1 /f`

2-4. PowerShellスクリプトブロックロギングオン “使用しない” (管理者権限で実行)

`reg delete “HKLM\SOFTWARE\Policies\Microsoft\Windows\PowerShell” /f`

2-5. PowerShellスクリプトブロックロギングオン “設定適用確認” (管理者権限で実行)

`reg query “HKLM\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging” /v “EnableScriptBlockLogging”`

WMF 5.1 インストール及び構成ダウンロードリンク

<https://docs.microsoft.com/ko-kr/powershell/scripting/windows-powershell/wmf/setup/install-configure?view=powershell-7>
