Skip to content

Update-Module does not really update the module #86

Open
@sdwheeler

Description

@sdwheeler

Update-Module only installs a newer version. It does not remove the previous version. This is no different that using Install-Module except that it checks the current installed version an searches for a newer version. That search functionality would be better implemented as a -Update parameter for Install-Module.

Expected Behavior

Update-Module should replace the current version with a new version. Not install the new version side-by-side with the old version.

Possible Solutions

  1. Deprecate Update-Module and move the search for update functionality into Install-Module.
  2. Change Update-Module to remove the old version. This needs to be smart enough to remove all old versions of nested modules without breaking dependencies in other installed modules.

Context

Using the verb Update is confusing to customers. They expect the cmdlet to update what they have not install side-by-side. Also, the cmdlet reference does not explain this behavior.

We see this a lot with Azure PowerShell. They release a new version every month. After a few months you can have several versions installed taking up a lot of space.

Your Environment

PS C:\Git>  $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.15063.296
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.15063.296
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1


PS C:\Git>  Get-Module

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     0.0        chocolateyProfile                   {TabExpansion, Update-SessionEnvironment, refreshenv}
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Cont...
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Script     0.7.0      posh-git                            {Add-PoshGitToProfile, Add-SshKey, Enable-GitColors, Get-Al...
Script     1.2        PSReadline                          {Get-PSReadlineKeyHandler, Get-PSReadlineOption, Remove-PSR...
Script     1.0.0.1    PSYaml                              {Convert-YAMLtoJSON, ConvertFrom-YAML, ConvertFrom-YAMLDocu...
Script     1.0        sdwheeler.utilities                 {close-SQLite, ConvertFrom-Base64, convertfrom-htmlencoding...


PS C:\Git>  Get-Module -ListAvailable PowerShellGet,PackageManagement


    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.1.3.0    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-Packag...
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-Packag...
Script     1.1.2.0    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}


PS C:\Git>  Get-PackageProvider

Name                     Version          DynamicOptions
----                     -------          --------------
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
NuGet                    2.8.5.207        Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag,...
PowerShellGet            1.1.2.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, I...
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent


PS C:\Git>  Get-PackageProvider -ListAvailable

Name                     Version          DynamicOptions
----                     -------          --------------
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
NuGet                    2.8.5.207        Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag,...
PowerShellGet            1.1.2.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, I...
PowerShellGet            1.0.0.1
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions