Skip to content

Install‑ModulePatch

viscalyxbot edited this page Feb 28, 2025 · 1 revision

SYNOPSIS

Applies patches to PowerShell modules based on a patch file.

SYNTAX

Path

Install-ModulePatch -Path <String> [-Force] [-SkipHashValidation] 
 [-WhatIf] [-Confirm] [<CommonParameters>]

URI

Install-ModulePatch -Uri <Uri> [-Force] [-SkipHashValidation] [-WhatIf]
 [-Confirm] [<CommonParameters>]

DESCRIPTION

The Install-ModulePatch command reads a patch file, validates its content, and applies patches to PowerShell modules. The patch file can be provided as a local file path or a URL. The command verifies the module version and hash, and replaces the content according to the patch file. It supports multiple patch entries in a single patch file, applying them in descending order of StartOffset.

EXAMPLES

EXAMPLE 1

Install-ModulePatch -Path "C:\patches\MyModule_1.0.0_patch.json"

Applies the patches specified in the patch file located at "C:\patches\MyModule_1.0.0_patch.json".

EXAMPLE 2

Install-ModulePatch -Uri "https://gist.githubusercontent.com/user/gistid/raw/MyModule_1.0.0_patch.json"

Applies the patches specified in the patch file located at the specified URL.

PARAMETERS

-Force

Overrides the confirmation dialogs.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-Path

Specifies the path to the patch file.

Type: String
Parameter Sets: Path
Aliases:

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

-SkipHashValidation

Skips the hash validation after patching are completed.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-Uri

Specifies the URL of the patch file.

Type: Uri
Parameter Sets: URI
Aliases:

Required: True
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

-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

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

None. You cannot pipe input to this function.

OUTPUTS

None. The function does not generate any output.

NOTES

RELATED LINKS

Clone this wiki locally