Skip to content
Sponsor
3.0 preview2.3.0 stable

These docs describe the preview. Pick the version you run and every page marks what it doesn't have yet. Get the preview →
Maester 2.x docs (archived) →

Restore-MtPack

Installs exactly the packs and modules that maester-packs.lock.json records, on a new computer or in a pipeline.

Restore-MtPack [[-Id] <String[]>] [-PackLock <String>] [-Token <SecureString>]
[-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]

For each pack in the lock file whose files are not in the local pack store, the recorded commit is fetched and its digest must equal the digest in the lock file; a pack whose files differ is not restored. Each module in the lock file is saved at its exact version and must match its recorded digest. Nothing is asked: the lock file is the approval, made when the pack was installed. A module that was externally managed when it was approved is not saved; it must be installed on this computer at the same version and with the same files.

Run it before Invoke-Maester in a pipeline that commits maester-config.json and maester-packs.lock.json.

Restore-MtPack

Restores every pack of the lock file found from the current folder.

Restore-MtPack -PackLock ./maester/maester-packs.lock.json; Invoke-Maester -Path ./maester

Restores, then runs, in a pipeline.

Restore-MtPack -Token (Get-Secret -Name PackReadToken)

Restores packs from private repositories with a token read from a secret vault.

Restore only these packs. By default every pack in the lock file.

Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

The lock file to restore from. By default the one beside the Maester config found from the current folder, else the user’s.

Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

A GitHub token that can read the pack’s repository, as a SecureString, for a private or internal repository. It is used for this command only, is sent to api.github.com only, and is not stored. When it is given, no other sign-in is tried. Without it, Maester uses the first of these that can read the repository: the sign-in of Connect-MtGitHub in this session, the GitHub CLI (gh auth token, when gh is installed and signed in), then the GH_TOKEN and GITHUB_TOKEN environment variables. An environment variable can be read by every process and module in the session, including installed packs, so prefer the other ways outside a pipeline. A fine-grained token needs only read-only Contents access to the one repository.

Type: SecureString
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

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

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

Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by Write-Progress.

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

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

https://maester.dev/docs/commands/Restore-MtPack