Επεξεργασία

Κοινή χρήση μέσω


Update-PSModuleManifest

Updates a module manifest file.

Syntax

Update-PSModuleManifest
      [-Path] <String>
      [-NestedModules <Object[]>]
      [-Guid <Guid>]
      [-Author <String>]
      [-CompanyName <String>]
      [-Copyright <String>]
      [-RootModule <String>]
      [-ModuleVersion <Version>]
      [-Description <String>]
      [-ProcessorArchitecture <ProcessorArchitecture>]
      [-CompatiblePSEditions <String[]>]
      [-PowerShellVersion <Version>]
      [-ClrVersion <Version>]
      [-DotNetFrameworkVersion <Version>]
      [-PowerShellHostName <String>]
      [-PowerShellHostVersion <Version>]
      [-RequiredModules <Object[]>]
      [-TypesToProcess <String[]>]
      [-FormatsToProcess <String[]>]
      [-ScriptsToProcess <String[]>]
      [-RequiredAssemblies <String[]>]
      [-FileList <String[]>]
      [-ModuleList <Object[]>]
      [-FunctionsToExport <String[]>]
      [-AliasesToExport <String[]>]
      [-VariablesToExport <String[]>]
      [-CmdletsToExport <String[]>]
      [-DscResourcesToExport <String[]>]
      [-Tags <String[]>]
      [-ProjectUri <Uri>]
      [-LicenseUri <Uri>]
      [-IconUri <Uri>]
      [-ReleaseNotes <String>]
      [-Prerelease <String>]
      [-HelpInfoUri <Uri>]
      [-DefaultCommandPrefix <String>]
      [-ExternalModuleDependencies <String[]>]
      [-RequireLicenseAcceptance]
      [-PrivateData <Hashtable>]
      [<CommonParameters>]

Description

This cmdlet updates the data stored in a module manifest file. The parameters allow you to specify which properties get updated. Update-PSModuleManifest overwrites any existing values in the module manifest.

The cmdlet doesn't return an object.

Examples

Example 1

This example changes the Author property in the module manifest to New Author.

Update-PSModuleManifest -Path 'C:\MyModules\TestModule' -Author 'New Author'

Example 2

This example changes the Prerelease property to beta2.

Update-PSModuleManifest -Path 'C:\MyModules\TestModule' -Prerelease 'beta2'

Example 3

This example updates multiple properties.

$parameters = @{
    Path = 'C:\MyModules\TestModule'
    Tags = 'Windows', 'Linux'
    Description = 'A module for managing packages.'
}
Update-PSModuleManifest

Parameters

-AliasesToExport

Specifies the aliases that the module exports. Wildcards are permitted.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:True

-Author

Specifies the module author.

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

-ClrVersion

Specifies the minimum version of the Common Language Runtime (CLR) of the Microsoft .NET Framework required by the module.

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

-CmdletsToExport

Specifies the cmdlets that the module exports. Wildcards are permitted.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:True

-CompanyName

Specifies the company or vendor who created the module.

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

-CompatiblePSEditions

Specifies the compatible PSEditions of the module. For information about PSEdition, see Modules with compatible PowerShell Editions.

Type:String[]
Accepted values:Desktop, Core
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Specifies a copyright statement for the module.

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

-DefaultCommandPrefix

Specifies the default command prefix.

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

-Description

Specifies a description of the module.

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

-DotNetFrameworkVersion

Specifies the minimum version of the Microsoft .NET Framework required by the module.

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

-DscResourcesToExport

Specifies the Desired State Configuration (DSC) resources that the module exports. Wildcards are permitted.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:True

-ExternalModuleDependencies

Specifies an array of external module dependencies.

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

-FileList

Specifies all items that are included in the module.

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

-FormatsToProcess

Specifies the formatting files (.ps1xml) that are processed when the module is imported.

When you import a module, PowerShell runs the Update-FormatData cmdlet with the specified files. Because formatting files aren't scoped, they affect all session states in the session.

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

-FunctionsToExport

Specifies the functions that the module exports. Wildcards are permitted.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:True

-Guid

Specifies a unique identifier for the module. The GUID is used to distinguish between modules with the same name.

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

-HelpInfoUri

Specifies the internet address of the module's HelpInfo XML file. Enter a Uniform Resource Identifier (URI) that begins with http: or https:.

For more information, see Updatable Help.

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

-IconUri

Specifies the URI of an icon for the module. The specified icon is displayed on the gallery web page for the module.

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

-LicenseUri

Specifies the URL of licensing terms for the module.

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

-ModuleList

Specifies an array of modules that are included in the module.

Enter each module name as a string or as a hashtable with ModuleName and ModuleVersion keys. The hashtable can also have an optional GUID key. You can combine strings and hashtables in the parameter value.

This key is designed to act as a module inventory.

Type:Object[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ModuleVersion

Specifies the version of the module.

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

-NestedModules

Specifies script modules (.psm1) and binary modules (.dll) that are imported into the module's session state. The files in the NestedModules key run in the order in which they're listed.

Enter each module name as a string or as a hashtable with ModuleName and ModuleVersion keys. The hashtable can also have an optional GUID key. You can combine strings and hashtables in the parameter value.

Type:Object[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Path

Specifies the path and filename of the module manifest. Enter filename with a .psd1 file extension.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PowerShellHostName

Specifies the name of the PowerShell host program that the module requires. Enter the name of the host program, such as PowerShell ISE Host or ConsoleHost. Wildcards aren't permitted.

The name of a host program is stored in $Host.Name.

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

-PowerShellHostVersion

Specifies the minimum version of the PowerShell host program that works with the module. Enter a version number, such as 1.1.

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

-PowerShellVersion

Specifies the minimum version of PowerShell that works with this module. For example, you can specify versions such as 5.1 or 7.2.

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

-Prerelease

Specifies the prerelease value that's appended to the module version. For example, if Prerelease is preview and the ModuleVersion is 1.0.0, the version of the module is 1.0.0-preview.

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

-PrivateData

Specifies data that's passed to the module when it's imported. This can be any arbitrary values stored in a hashtable.

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

-ProcessorArchitecture

Specifies the processor architecture that the module requires.

The acceptable values for this parameter are:

  • Amd64
  • Arm
  • IA64
  • MSIL
  • None (unknown or unspecified)
  • X86
Type:ProcessorArchitecture
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ProjectUri

Specifies the URI of a web page about this project.

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

-ReleaseNotes

Specifies a string that contains release notes or comments for the module.

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

-RequiredAssemblies

Specifies the assembly (.dll) files required by the module. PowerShell loads the specified assemblies before updating types or formats, importing nested modules, or importing the module file specified in the RootModule key.

Use RequiredAssemblies for assemblies that must be loaded to update any formatting or type files that are listed in the FormatsToProcess or TypesToProcess keys, even if those assemblies are also listed in the NestedModules key.

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

-RequiredModules

Specifies modules that must be in the global session state. If the required modules aren't in the global session state, PowerShell imports them. If the required modules aren't available, the Import-Module command fails.

The value can be an array containing module names or module specifications. A module specification is a hashtable that has the following keys.

  • ModuleName - Required Specifies the module name.
  • GUID - Optional Specifies the GUID of the module.
  • It's also Required to specify at least one of the three below keys.
    • ModuleVersion - Specifies a minimum acceptable version of the module.
    • MaximumVersion - Specifies the maximum acceptable version of the module.
    • RequiredVersion - Specifies an exact, required version of the module. This can't be used with the other Version keys.
Type:Object[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RequireLicenseAcceptance

Specifies that a license acceptance is required for the module.

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

-RootModule

Specifies the primary or root file of the module. Enter the filename of a script (.ps1), a script module (.psm1), a module manifest (.psd1), an assembly (.dll), or a cmdlet definition XML file (.cdxml). When the module is imported, the members exported from the root module are imported into the caller's session state.

If a module has a manifest file and no file is specified in the RootModule key, the manifest becomes the primary file for the module. The module is known as a manifest module (ModuleType = Manifest).

To export members from .psm1 or .dll files, the names of those files must be specified in the values of the RootModule or NestedModules keys in the manifest.

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

-ScriptsToProcess

Specifies script (.ps1) files that run in the caller's session state when the module is imported. You can use these scripts to prepare an environment, just as you might use a login script.

To specify scripts that run in the module's session state, use the NestedModules key.

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

-Tags

Specifies an array of tags.

Type:String[]
Aliases:Tag
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TypesToProcess

Specifies the type files (.ps1xml) that run when the module is imported.

When you import the module, PowerShell runs the Update-TypeData cmdlet with the specified files. Because type files aren't scoped, they affect all session states in the session.

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

-VariablesToExport

Specifies the variables that the module exports. Wildcards are permitted.

Use this parameter to restrict which variables that are exported by the module.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:True

Inputs

None

Outputs

Object

Notes

For a full description of the module manifest file, see about_Module_Manifests.