Save-Module

Saves a module locally without installing it.

Syntax

Save-Module
    [-Name] <String[]>
    [-MinimumVersion <Version>]
    [-MaximumVersion <Version>]
    [-RequiredVersion <Version>]
    [-Repository <String[]>]
    -Path <String>
    [-Proxy <Uri>]
    [-ProxyCredential <PSCredential>]
    [-Credential <PSCredential>]
    [-Force]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]
Save-Module
    [-Name] <String[]>
    [-MinimumVersion <Version>]
    [-MaximumVersion <Version>]
    [-RequiredVersion <Version>]
    [-Repository <String[]>]
    -LiteralPath <String>
    [-Proxy <Uri>]
    [-ProxyCredential <PSCredential>]
    [-Credential <PSCredential>]
    [-Force]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]
Save-Module
    -InputObject <PSObject[]>
    -LiteralPath <String>
    [-Proxy <Uri>]
    [-ProxyCredential <PSCredential>]
    [-Credential <PSCredential>]
    [-Force]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]
Save-Module
    -InputObject <PSObject[]>
    -Path <String>
    [-Proxy <Uri>]
    [-ProxyCredential <PSCredential>]
    [-Credential <PSCredential>]
    [-Force]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Save-Module cmdlet saves a module locally from the specified repository for inspection. The module is not installed.

Examples

Example 1: Find modules and save them locally

PS C:\> Find-Module -Name "AzureAutomationDebug" -Repository "PSGallery"

Version    Name                                Type       Repository           Description

-------    ----                                ----       ----------           -----------

1.3.5      AzureAutomationDebug                Module     PSGallery            Module for debugging Azure Automation runbooks, emulating AA native cmdlets



PS C:\> Find-Module -Name "AzureAutomationDebug" -Repository "PSGallery" -IncludeDependencies

Version    Name                                Type       Repository           Description

-------    ----                                ----       ----------           -----------

1.3.5      AzureAutomationDebug                Module     PSGallery            Module for debugging Azure Automation runbooks, emulating AA native cmdlets

1.0.1      AzureRM.Automation                  Module     PSGallery            Microsoft Azure PowerShell - Automation service cmdlets for Azure Resource Manager

1.0.1      AzureRM.profile                     Module     PSGallery            Microsoft Azure PowerShell - Profile credential management cmdlets for Azure Resource Manager



PS C:\> Find-Module -Name "AzureAutomationDebug" -Repository "PSGallery" | Save-Module -Path "C:\MyLocalModules\"



PS C:\> dir C:\MyLocalModules\

    Directory: C:\MyLocalModules





Mode                LastWriteTime         Length Name

----                -------------         ------ ----

d-----       12/14/2015  11:20 AM                AzureAutomationDebug

d-----       12/14/2015  11:20 AM                AzureRM.Automation

d-----       12/14/2015  11:20 AM                AzureRM.profile



PS C:\> Save-Module -LiteralPath "C:\MyLocalModules\" -Name "xPSDesiredStateConfiguration" -Repository "PSGallery" -MinimumVersion 2.0 -MaximumVersion 3.5.0

PS C:\> dir C:\MyLocalModules

   Directory: C:\MyLocalModules





Mode                LastWriteTime         Length Name

----                -------------         ------ ----

d-----       12/14/2015  11:22 AM                xPSDesiredStateConfiguration

The first command uses the Find-Module cmdlet to find the AzureAutomationDebug module in the PSGallery repository and displays the results.

The second command uses Find-Module to find the AzureAutomationDebug module and its dependencies, and displays the results.

The third command uses Find-Module to find the AzureAutomationDebug module, and then uses the pipeline operator to pass the module to the Save-Module cmdlet, which save the module to the specified folder.

The fourth command displays the contents of the saved module.

The fifth command saves the specified versions of the module xPSDesiredStateConfiguration to C:\MyLocalModules.

The final command displays the contents of the C:\MyLocalModules folder.

Required Parameters

-InputObject

{{Fill InputObject Description}}

Type: PSObject[]
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
-LiteralPath

Specifies a path to one or more locations. Unlike the Path parameter, the value of the LiteralPath parameter is used exactly as entered. No characters are interpreted as wildcards. If the path includes escape characters, enclose them in single quotation marks. Windows PowerShell does not interpret any characters that are enclosed in single quotation marks as escape sequences.

Type: String
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Name

Specifies an array of names of modules to save.

Type: String[]
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-Path

Specifies the path to the module that you want to publish. This parameter accepts either the path to the folder that contains the module, or the module manifest (.psd1) file. The parameter accepts piped values from Get-Module.

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

Optional Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Aliases: cf
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Credential
Type: PSCredential
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-Force

Forces the command to run without asking for user confirmation.

Type: SwitchParameter
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-MaximumVersion

Specifies the maximum, or newest, version of the module to save. The MaximumVersion and RequiredVersion parameters are mutually exclusive; you cannot use both parameters in the same command.

Type: Version
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-MinimumVersion

Specifies the minimum version of a single module to save. You cannot add this parameter if you are attempting to install multiple modules. The MinimumVersion and RequiredVersion parameters are mutually exclusive; you cannot use both parameters in the same command.

Type: Version
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-Proxy
Type: Uri
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-ProxyCredential
Type: PSCredential
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-Repository

Specifies the friendly name of a repository that has been registered by running Register-PSRepository.

Type: String[]
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-RequiredVersion

Specifies the exact version number of the module to save.

Type: Version
Position: Named
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
Aliases: wi
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False