Policy
Turn on PowerShell Script Block Logging
Windows 11 25H2
Policy overview
Key metadata and intent for this policy.
Supported OS tags: Windows7, WindowsServer2008
This policy setting enables logging of all PowerShell script input to the Microsoft-Windows-PowerShell/Operational event log. If you enable this policy setting, Windows PowerShell will log the processing of commands, script blocks, functions, and scripts - whether invoked interactively, or through automation. If you disable this policy setting, logging of PowerShell script input is disabled. If you enable the Script Block Invocation Logging, PowerShell additionally logs events when invocation of a command, script block, function, or script starts or stops. Enabling Invocation Logging generates a high volume of event logs. Note: This policy setting exists under both Computer Configuration and User Configuration in the Group Policy Editor. The Computer Configuration policy setting takes precedence over the User Configuration policy setting.
Registry values
How enabled and disabled states update the registry.
| Registry location | Type | Enabled value | Disabled value |
|---|---|---|---|
| HKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging\EnableScriptBlockLogging | REG_DWORD | 1 | 0 |
Policy elements
Inputs and configuration options exposed by this policy.
| Element | Type | Registry mapping | Constraints & behavior |
|---|---|---|---|
Log script block invocation start / stop events: ID EnableScriptBlockInvocationLogging | boolean | HKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging\EnableScriptBlockInvocationLogging Type REG_DWORD | Options: true (), false () True: None · False: None |
Other policies in this category
Explore related policies at the same level.
- UserSet the default source path for Update-HelpAt least Microsoft Windows 7 or Windows Server 2008 family
- ComputerSet the default source path for Update-HelpAt least Microsoft Windows 7 or Windows Server 2008 family
- UserTurn on Module LoggingAt least Microsoft Windows 7 or Windows Server 2008 family
- ComputerTurn on Module LoggingAt least Microsoft Windows 7 or Windows Server 2008 family
- ComputerTurn on PowerShell Script Block LoggingAt least Microsoft Windows 7 or Windows Server 2008 family
- ComputerTurn on PowerShell TranscriptionAt least Microsoft Windows 7 or Windows Server 2008 family
- UserTurn on PowerShell TranscriptionAt least Microsoft Windows 7 or Windows Server 2008 family
- ComputerTurn on Script ExecutionAt least Microsoft Windows 7 or Windows Server 2008 family
- UserTurn on Script ExecutionAt least Microsoft Windows 7 or Windows Server 2008 family