PowerShellGetv2 icon indicating copy to clipboard operation
PowerShellGetv2 copied to clipboard

Update-Module doensn't properly support -WhatIf

Open kilasuit opened this issue 6 years ago • 3 comments

Steps to reproduce

Update-Module Az.cnd -verbose -whatif

Expected behavior

provides whatif output 

Actual behavior

Attempts to install the module if new version is available

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.18941.1001
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18941.1001
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
> Get-Module -ListAvailable PowerShellGet,PackageManagement
    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.1.7.2    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Script     2.0.1      PowerShellGet                       {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability...}
Script     2.0.0      PowerShellGet                       {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability...}
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}
> Get-PackageProvider -ListAvailable
Name                     Version          DynamicOptions
----                     -------          --------------
Chocolatey               2.8.5.130        SkipDependencies, ContinueOnFailure, ExcludeVersion, ForceX86, PackageSaveMode, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipValidate
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
nuget                    2.8.5.208
NuGet                    2.8.5.210        Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipValidate
PowerShellGet            2.0.1.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, AllowPrereleaseVersions, Filter, Tag, Includes, DscResource, RoleCapability, Command, AcceptLicense, PublishLocation, Scri...
PowerShellGet            2.0.0.0
PowerShellGet            1.0.0.1
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent

kilasuit avatar Jul 26 '19 16:07 kilasuit

@kilasuit thanks for reporting this and for providing detailed info! I am having a bit of difficulty reproducing this but I did notice that you are not running the latest version of PowerShellGet which could be contributing to the issue...are you able to update to PowerShellGet 2.2 and test if you are still hitting this issue?

SydneyhSmith avatar Jul 29 '19 15:07 SydneyhSmith

I'm currently on PowerShellGet 2.1.3, from my end it appears to have updated AzureRM modules: image

The progress bar continues to come up when I do an update-module with -whatif , but it doesn't update the module... It also is slower with -whatif than without: image

(I'll update PowerShellGet and report back when I have the time.

corbob avatar Sep 09 '19 17:09 corbob

I've checked the file time of AzureRM.Billing, and it's 4 months old, so I don't think it's actually updating, but here's with powershell -noprofile -nologo running PowerShellGet 2.2.1:

update-module

corbob avatar Sep 09 '19 18:09 corbob