# PowerShell 스크립트 블록 로깅 활성화

### 1. PowerShell 스크립트 블록 로깅 활성화 방법 (영상) <a href="#id-1" id="id-1"></a>

{% embed url="<https://youtu.be/zbNXf4B__68>" %}

**동영상 챕터 요약**

* **00:38 \~ 01:10** → PowerShell 버전 5 이상인 경우
* **01:11 \~ 03:47** → PowerShell 하위 버전(Windows Server 2012 R2)인 경우
* **03:48 \~ 04:00** → 그 외 OS에서 PowerShell 하위 버전인 경우

### 2. PowerShell 명령어 <a href="#id-2" id="id-2"></a>

2-1. Powershell 버전 확인

```bash
$PSVersionTable.PSVersion.Major
```

2-2. Windows OS 버전 확인

```bash
Get-WmiObject Win32_OperatingSystem | Select -Property Name
```

2-3. PowerShell 스크립트 블록 로깅 "사용" 설정 (관리자 권한 필요)

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

2-4. PowerShell 스크립트 블록 로깅 "사용 안 함" 설정 (관리자 권한 필요)

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

2-5.PowerShell 스크립트 블록 로깅 설정 상태 확인 (관리자 권한 필요)

```bash
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>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.plura.io/ko/faq/siem/logging/powershell.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
