Skip to content

Read PSScript

PRASOON KARUNAN V edited this page Nov 27, 2016 · 4 revisions

Description

This cmdlet shows the specified script by adding line numbers and error occurred lines as per the parameters specified. This cmdlet has three parameter sets and parameter '-Script' is the only Mandatory parameter.This functionality will be handy in case of Administration using console only option to analyze error occurring areas of a script.

Example 1

PS C:\> Read-PSScript -Script .\test.ps1

Reads the script and output script as plaintext including line numbers.

Example 2

PS C:\> Read-PSScript -Script .\test.ps1 -HighlightLine (1..5).

Reads and outputs the script by highlighting first five lines.

Example 3

PS C:\> Read-PSScript -Script .\test.ps1 -ExecuteAndShowBadLineAs Raw

Executes the script as usual and shows the script as text after script execution by highlighting error caused lines.

Example 4

PS C:\> Read-PSScript -Script .\test.ps1 -ExecuteAndShowBadLineAs TextTable

Executes script as usual and shows the Script output,Errors and Error occured line,Expression,Exception and Message as plain text Table.

Example 5

PS C:\> Read-PSScript -Script .\test.ps1 -ExecuteAndShowBadLineAs TextTable -HideError

Execute script as usual and shows the Script output and error details as plain text table by hiding Error occured.

Example 6

PS C:\> Read-PSScript -Script .\test.ps1 -ExecuteAndShowBadLineAs TextTable -HideError -HideOutput

Execures the script as ususal and shows only the error details as plaint text table by hiding script output and error occurred.

Clone this wiki locally