PowerShell, a versatile scripting language, is increasingly becoming a popular target for malicious actors to exploit. As a result, it is crucial for organizations to start Enhancing PowerShell Telemetry to detect and respond to potential threats if they have not already done so.

By utilizing PowerShell telemetry tools and log sources, organizations can enhance their security posture and effectively detect, investigate, and mitigate any suspicious activity. In today’s ever-evolving threat landscape, it is essential for companies and organizations to take a proactive approach towards ensuring their security.

Enhancing PowerShell Telemetry

What is PowerShell?

PowerShell is a task automation and configuration management framework from Microsoft. It consists of a command-line shell and associated scripting language built on top of the .NET Framework. It is used for a variety of tasks, including system administration and automation. It is also used by malicious actors to perform malicious activities on systems.

Why is it important to Enhance PowerShell Telemetry Tools and Log Sources?

Enhancing PowerShell telemetry tools and log sources is essential to detect and mitigate threats. PowerShell is a powerful tool that can be used by malicious actors to perform malicious activities on systems. By collecting and analyzing telemetry data, security teams can detect and respond to threats in a timely manner. Additionally, log sources can be used to identify malicious activity and trace the source of the attack.

How to Collect Powershell Telemetry

  • Windows PowerShell Transcript Logs: PowerShell Transcript Logs contain a record of all the commands executed in a PowerShell session. To enable transcript logging, use the “Start-Transcript” command in PowerShell. The log file will be created in the location specified by the “TranscriptDirectory” parameter.
  • Windows Event Logs: Windows Event Logs can provide detailed information about PowerShell activity on a system. PowerShell events are logged in the “Windows PowerShell” event log. To view these logs, open Event Viewer, navigate to “Windows Logs” > “Windows PowerShell,” and review the events.
  • Sysinternals Sysmon: Sysinternals Sysmon is a powerful system monitoring tool that can provide detailed telemetry on PowerShell activity. To configure Sysmon to monitor PowerShell, download and install Sysmon, then use the following command to create a Sysmon configuration file: “sysmon.exe -c path_to_config_file.xml”. The configuration file should include the following rule: “800”. This will capture events related to PowerShell script block logging.
  • PowerShell Module Logging: PowerShell Module Logging can provide detailed information about the execution of PowerShell modules. To enable module logging, use the “Enable-ModuleLogging” command in PowerShell. The logs will be written to the “Windows PowerShell Modules” event log.

Detailed Descriptions:

Windows PowerShell Transcript Logs – Enhancing PowerShell Telemetry

To enable transcript logging, use the following command in PowerShell

Start-Transcript -Path “C:\Logs\PowerShellTranscript.log”
This will create a transcript log file in the specified directory that contains a record of all the commands executed in the PowerShell session.

Windows Event Logs – Enhancing PowerShell Telemetry

To view PowerShell-related events in the Windows Event Logs, follow these steps:

  1. Open Event Viewer by searching for “Event Viewer” in the Start menu.
  2. Navigate to “Windows Logs” > “Windows PowerShell.”
  3. Review the events to view information about PowerShell activity on the system.

Sysinternals Sysmon – Enhancing PowerShell Telemetry

To configure Sysmon to capture events related to PowerShell script block logging, follow these steps

  1. Go to Microsofts site for sysinternals https://learn.microsoft.com/en-us/sysinternals/downloads/
  2. Select Downloads
  3. Search for the latest sysmon version and click the link
  4. Read. Read. and use olaf’s config https://github.com/olafhartong/sysmon-modular

PowerShell Module Logging

To enable PowerShell module logging, use the following command in PowerShell:

Enable-ModuleLogging -Module PowerShell*


This will write module execution information to the “Windows PowerShell Modules” event log.

PowerShell Log Sources

When reviewing PowerShell logs on an endpoint, there are several key indicators to look for to determine if the activity is malicious or not.

One of the first things to look for is any unusual or unexpected commands being executed, especially those that involve network connections, file downloads, or system modifications. Additionally, it is important to look for any attempts to bypass security measures or gain elevated privileges, such as running PowerShell scripts as an administrator or using exploit tools.

Another red flag is any attempt to hide or obfuscate activity, such as the use of encoded or encrypted commands. Additionally, it is important to look for patterns of suspicious behavior, such as repeated attempts to access restricted resources or abnormal activity during non-business hours.

Finally, it is important to keep an eye out for any known malicious PowerShell commands or scripts, which can be identified using threat intelligence sources or security tools. By being vigilant and looking for these key indicators, security professionals can quickly identify and respond to potentially malicious activity on their endpoints.

Best Practices for Enhancing PowerShell Telemetry Tools and Log Sources

To improve PowerShell telemetry tools and log sources, organizations can adopt a set of best practices. These include:

  1. Enable logging and auditing: Enabling logging and auditing of PowerShell activity is crucial for organizations to monitor and track activity, identify any malicious activity, and respond to threats promptly.
  2. Use a centralized logging solution: Using a centralized logging solution allows organizations to collect and analyze log data from various sources. This empowers security teams to detect any malicious activity and trace the source of the attack.
  3. Monitor PowerShell activity: By utilizing PowerShell telemetry tools and log sources, organizations can monitor PowerShell activity. This practice enables them to detect any malicious activity and respond to threats quickly.
  4. Implement security controls: Implementing security controls is essential to safeguard against malicious activity. These controls can include anti-malware and firewall solutions, whitelisting applications, and restricting access to systems.
  5. By following these best practices, organizations can enhance their PowerShell telemetry tools and log sources, enabling them to proactively detect and respond to potential security threats.

Conclusion – Enhancing PowerShell Telemetry

In conclusion, implementing effective PowerShell telemetry tools and log sources is critical in detecting and mitigating potential security threats posed by malicious actors. It is essential for organizations to have a clear understanding of their environment and what constitutes normal PowerShell activity versus abnormal behavior.

By following the best practices outlined in this blog post, organizations can proactively protect their systems and infrastructure against PowerShell-based attacks.

By continuously monitoring PowerShell activity, analyzing logs, and utilizing centralized logging solutions, organizations can quickly identify and respond to any suspicious activity, mitigating potential damage caused by attacks. Ultimately, prioritizing PowerShell security is crucial for safeguarding organizational assets and maintaining business continuity.

Leave a Reply

Only people in my network can comment.