mirror of
https://github.com/MicrosoftDocs/windows-itpro-docs.git
synced 2025-05-12 13:27:23 +00:00
92 lines
3.1 KiB
Markdown
92 lines
3.1 KiB
Markdown
---
|
|
title: Policy CSP - WindowsPowerShell
|
|
description: Use the Policy CSP - WindowsPowerShell setting to enable logging of all PowerShell script input to the Microsoft-Windows-PowerShell/Operational event log.
|
|
ms.author: vinpa
|
|
ms.topic: article
|
|
ms.prod: w10
|
|
ms.technology: windows
|
|
author: vinaypamnani-msft
|
|
ms.localizationpriority: medium
|
|
ms.date: 09/27/2019
|
|
ms.reviewer:
|
|
manager: aaroncz
|
|
---
|
|
|
|
# Policy CSP - WindowsPowerShell
|
|
|
|
<hr/>
|
|
|
|
<!--Policies-->
|
|
## WindowsPowerShell policies
|
|
|
|
<dl>
|
|
<dd>
|
|
<a href="#windowspowershell-turnonpowershellscriptblocklogging">WindowsPowerShell/TurnOnPowerShellScriptBlockLogging</a>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
<hr/>
|
|
|
|
<!--Policy-->
|
|
<a href="" id="windowspowershell-turnonpowershellscriptblocklogging"></a>**WindowsPowerShell/TurnOnPowerShellScriptBlockLogging**
|
|
|
|
<!--SupportedSKUs-->
|
|
The table below shows the applicability of Windows:
|
|
|
|
|Edition|Windows 10|Windows 11|
|
|
|--- |--- |--- |
|
|
|Home|No|No|
|
|
|Pro|Yes|Yes|
|
|
|Windows SE|No|Yes|
|
|
|Business|Yes|Yes|
|
|
|Enterprise|Yes|Yes|
|
|
|Education|Yes|Yes|
|
|
|
|
<!--/SupportedSKUs-->
|
|
<hr/>
|
|
|
|
<!--Scope-->
|
|
[Scope](./policy-configuration-service-provider.md#policy-scope):
|
|
|
|
> [!div class = "checklist"]
|
|
> * User
|
|
> * Device
|
|
|
|
<hr/>
|
|
|
|
<!--/Scope-->
|
|
<!--Description-->
|
|
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.
|
|
|
|
<!--/Description-->
|
|
> [!TIP]
|
|
> This is an ADMX-backed policy and requires a special SyncML format to enable or disable. For details, see [Understanding ADMX-backed policies](./understanding-admx-backed-policies.md).
|
|
>
|
|
> You must specify the data type in the SyncML as <Format>chr</Format>. For an example SyncML, refer to [Enabling a policy](./understanding-admx-backed-policies.md#enabling-a-policy).
|
|
>
|
|
> The payload of the SyncML must be XML-encoded; for this XML encoding, there are a variety of online encoders that you can use. To avoid encoding the payload, you can use CDATA if your MDM supports it. For more information, see [CDATA Sections](http://www.w3.org/TR/REC-xml/#sec-cdata-sect).
|
|
|
|
<!--ADMXBacked-->
|
|
ADMX Info:
|
|
- GP Friendly name: *Turn on PowerShell Script Block Logging*
|
|
- GP name: *EnableScriptBlockLogging*
|
|
- GP path: *Windows Components/Windows PowerShell*
|
|
- GP ADMX file name: *PowerShellExecutionPolicy.admx*
|
|
|
|
<!--/ADMXBacked-->
|
|
<!--/Policy-->
|
|
<hr/>
|
|
|
|
<!--/Policies-->
|
|
|
|
## Related topics
|
|
|
|
[Policy configuration service provider](policy-configuration-service-provider.md) |