PowerShell Script Block & Module Logging

PowerShell is used more and more by malicious actors. Microsoft Windows offers enhanced logging capabilities in PowerShell 5.0 and above. PowerShell 5.0 is the current release for Windows 7/2008 R2 and above. Though many of the enhanced logging features of PowerShell 5.0 were backported to version 4.0, Optiv recommends installing PowerShell 5.0 on all Windows platforms. PowerShell 5.0 includes features not available in 4.0, including suspicious script block logging.

You can determine what version of PowerShell is installed on a particular host by entering $PSVersionTable in the PowerShell window.

Installation: Windows 10 does not require any software updates to support enhanced PowerShell logging. For Windows 7/8.1/2008/2012, upgrading PowerShell to enable enhanced logging in PowerShell 5.0 (recommended) requires:

Enabling enhanced logging in PowerShell 4.0 for Windows 7/8.1/2008/2012 requires:

To turn on enhanced logging Open the Group Policy Editor and go to:

PowerShell Transcription

Computer Configuration > Administrative Templates > Windows Components > Windows PowerShell > Turn on PowerShell Transcription

PowerShell ScriptBlock

Computer Configuration > Administrative Templates > Windows Components > Windows PowerShell > Turn on Module Logging

PowerShell Module

Computer Configuration > Administrative Templates > Windows Components > Windows PowerShell > Turn on Module Logging

These settings will enhance PowerShell usage logging.