Skip to content

Latest commit

 

History

History
35 lines (24 loc) · 645 Bytes

File metadata and controls

35 lines (24 loc) · 645 Bytes
description ms.date ms.topic title
Avoid Using Invoke-Expression
06/28/2023
reference
AvoidUsingInvokeExpression

AvoidUsingInvokeExpression

Severity Level: Warning

Description

Care must be taken when using the Invoke-Expression command. The Invoke-Expression executes the specified string and returns the results.

Code injection into your application or script can occur if the expression passed as a string includes any data provided from the user.

How

Remove the use of Invoke-Expression.

Example

Wrong

Invoke-Expression 'Get-Process'

Correct

Get-Process