Skip to content

Repair ScriptStyle

github-actions edited this page Jul 28, 2026 · 1 revision

external help file: Codesmithy-help.xml Module Name: Codesmithy online version: https://docs.microsoft.com/powershell/module/psscriptanalyzer/invoke-scriptanalyzer schema: 2.0.0

Repair-ScriptStyle

SYNOPSIS

Accepts justifications for script analysis rule violations, fixing the rest using Invoke-ScriptAnalysis.

SYNTAX

Repair-ScriptStyle [-Path] <String> [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm]
 [<CommonParameters>]

DESCRIPTION

{{ Fill in the Description }}

EXAMPLES

EXAMPLE 1

Repair-ScriptStyle .\MyScript.ps1

PSAvoidUsingWriteHost in A:\Scripts\MyScript.ps1 (!) Warning Lines: 19, 24, 25, 26, 27, 31, 32 File 'MyScript.ps1' uses Write-Host. Avoid using Write-Host because it might not work in all hosts, does not work when there is no host, and (prior to PS 5.0) cannot be suppressed, captured, or redirected. Instead, use Write-Output, Write-Verbose, or Write-Information.

Confirm Are you sure you want to perform this action? Performing the operation "provide justification" on target "PSAvoidUsingWriteHost in A:\Scripts\MyScript.ps1". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):

PARAMETERS

-Path

The path to a PowerShell script file to repair the style of.

Type: String
Parameter Sets: (All)
Aliases: FullName

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES

RELATED LINKS

https://docs.microsoft.com/powershell/module/psscriptanalyzer/invoke-scriptanalyzer

Clone this wiki locally