Skip to content

Get‑ModuleFileSha

viscalyxbot edited this page Feb 28, 2025 · 1 revision

SYNOPSIS

Retrieves the SHA256 hash of all ps1, psm1, and psd1 files in a PowerShell module.

SYNTAX

ModuleName

Get-ModuleFileSha -Name <String> [-Version <String>] [<CommonParameters>]

Path

Get-ModuleFileSha -Path <String> [<CommonParameters>]

DESCRIPTION

The Get-ModuleFileSha function retrieves the SHA256 hash of all ps1, psm1, and psd1 files in a PowerShell module. It takes a module name, module version, and Path as parameters. The function loops through all the ps1, psm1, and psd1 files that the module consists of and outputs each file with its corresponding SHA using the SHA256 algorithm.

EXAMPLES

EXAMPLE 1

Get-ModuleFileSha -Name 'MyModule' -Version '1.0.0'

Retrieves the SHA256 hash of all ps1, psm1, and psd1 files in the 'MyModule' module with version '1.0.0'.

EXAMPLE 2

Get-ModuleFileSha -Path 'C:\Modules\MyModule\1.0.0'

Retrieves the SHA256 hash of all ps1, psm1, and psd1 files in the module located at 'C:\Modules\MyModule'.

PARAMETERS

-Name

Specifies the name of the module.

Type: String
Parameter Sets: ModuleName
Aliases:

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

-Path

Specifies the path to the root of module for a specific version.

Type: String
Parameter Sets: Path
Aliases:

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

-Version

Specifies the version of the module.

Type: String
Parameter Sets: ModuleName
Aliases:

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

System.Object. The function returns a list of files with their corresponding SHA256 hash.

NOTES

RELATED LINKS

Clone this wiki locally