Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating Pester on Windows 10 1809 throw an exception #1201

Closed
ghost opened this issue Jan 8, 2019 · 13 comments
Closed

Updating Pester on Windows 10 1809 throw an exception #1201

ghost opened this issue Jan 8, 2019 · 13 comments

Comments

@ghost
Copy link

ghost commented Jan 8, 2019

1. General summary of the issue

Updating Pester by command described in the README document (Install-Module -Name Pester -Force), throw a PublishersMismatch exception:

A Microsoft-signed module named 'Pester' with version '3.4.0' that was previously installed conflicts with the new module 'Pester' from publisher 'CN=DigiCert Assured ID Root CA, OU=www.digicert.com, O=DigiCert Inc, C=US' with version '4.4.4'. Installing the new module may result in system instability. If you still want to install or update, use -SkipPublisherCheck parameter.

2. Describe Your Environment

Pester version     : 3.4.0 C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Pester.psd1
PowerShell version : 5.1.17763.134
OS version         : Microsoft Windows NT 10.0.17763.0

3. Expected Behavior

The command Install-Module -Name Pester -Force installs a new Pester version side-by-side with the already installed version.

4.Current Behavior

The command Install-Module -Name Pester -Force throw the exception with FullyQualifiedError Id PublishersMismatch,Validate-ModuleAuthenticodeSignature,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage.

5. Possible Solution

At this moment, enabling the SkipPublisherCheck switch solves the issue.

@nohwnd
Copy link
Member

nohwnd commented Jan 8, 2019

@robdesideri Thanks for reporting this. This is a whole new level of awfulness. Could you tell me what versions of PowerShell get you have please?

get-module powershellget -List

@ghost
Copy link
Author

ghost commented Jan 8, 2019

Hi @nohwnd,

Could you tell me what versions of PowerShell get you have please?

1.0.0.1

@fflaten
Copy link
Collaborator

fflaten commented Jan 8, 2019

I can reproduce it with both PowerShellGet 1.0.0.1 (built-in) and latest 2.0.3 on PowerShell 5.1 (latest Win10 insider). When you only have the built-in 3.4.0 version of Pester installed, the exception is thrown. If you already have 4.4.3 and try to install 4.4.4, then it installs fine with just -Force.

@nohwnd
Copy link
Member

nohwnd commented Jan 9, 2019

I cannot replicate this, with the newer PowerShellGet. @fflaten are you sure you have the correct PowerShellGet version loaded?

image

Using the built-in 1.6.0 version of PoweShellGet module I get the error you see because there is no exclusion for Pester, and so -SkipPublisherCheck has to be used. So to me everything looks like it works as expected.

image

So @robdesideri I can only recommed updating your PowerShellGet.

@zlatin
Copy link

zlatin commented Mar 12, 2019

I think Wiki should mention updating PowerShellGet if this error occurs. Not everyone will look at closed issue to resolve the problem.

@nohwnd
Copy link
Member

nohwnd commented Mar 12, 2019

@zlatin agree :) wiki is free to edit, feel free to add the info. If you don't I will add it over the weekend. https://github.com/pester/Pester/wiki/Installation-and-Update#installing-from-psgallery-windows-10-or-windows-server-2016

@nohwnd nohwnd reopened this Mar 12, 2019
@bmkaiser
Copy link

I've installed PowerShellGet 2.1.4 and am running Windows 10 1809 with PSVersion 5.1.17763.503 and am also getting the error described by @fflaten.

PS C:\WINDOWS\system32> $PSVersionTable

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


PS C:\WINDOWS\system32> Get-Module -Name PowerShellGet -ListAvailable


    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     2.1.4      PowerShellGet                       {Find-Command, Find-DSCResource, Find-Module, Find-RoleCap...
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}


PS C:\WINDOWS\system32> Get-Module -Name PowerShellGet

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     2.1.4      PowerShellGet                       {Find-Command, Find-DscResource, Find-Module, Find-RoleCap...


PS C:\WINDOWS\system32> Get-Module -Name Pester -ListAvailable


    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     3.4.0      Pester                              {Describe, Context, It, Should...}


PS C:\WINDOWS\system32> Install-Module -Name Pester -Force -Repository PSGallery
PackageManagement\Install-Package : A Microsoft-signed module named 'Pester' with version '3.4.0' that was previously 
installed conflicts with the new module 'Pester' from publisher 'CN=DigiCert Assured ID Root CA, OU=www.digicert.com, 
O=DigiCert Inc, C=US' with version '4.8.1'. Installing the new module may result in system instability. If you still 
want to install or update, use -SkipPublisherCheck parameter.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.1.4\PSModule.psm1:9521 char:21
+ ...          $null = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], 
Exception
    + FullyQualifiedErrorId : 
PublishersMismatch,Validate-ModuleAuthenticodeSignature,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
PackageManagement\Install-Package : A Microsoft-signed module named 'Pester' with version '3.4.0' that was previously
installed conflicts with the new module 'Pester' from publisher 'CN=DigiCert Assured ID Root CA, OU=www.digicert.com,
O=DigiCert Inc, C=US' with version '4.8.1'. Installing the new module may result in system instability. If you still
want to install or update, use -SkipPublisherCheck parameter.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.1.4\PSModule.psm1:9521 char:21
+ ...          $null = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package],
   Exception
    + FullyQualifiedErrorId : PublishersMismatch,Validate-ModuleAuthenticodeSignature,Microsoft.PowerShell.PackageMana
   gement.Cmdlets.InstallPackage

@hassant
Copy link

hassant commented Sep 2, 2019

$module = "C:\Program Files\WindowsPowerShell\Modules\Pester"
takeown /F $module /A /R
icacls $module /reset
icacls $module /grant Administrators:'F' /inheritance:d /T
Remove-Item -Path $Module -Recurse -Force -Confirm:$false

Install-Module -Name Pester -Force

@thuld
Copy link

thuld commented Nov 8, 2019

@hassant Your code does not solve my problem: After executing icacls $module /grant Administrators:'F' /inheritance:d /T is the following error shown:

Administrators: No mapping between account names and security IDs was done.
Successfully processed 0 files; Failed processing 1 files

Any idea on how I could make this work?

@thuld
Copy link

thuld commented Nov 8, 2019

It was possible when using the the name of my local user "foobar" instead of "Administrators"

icacls $module /grant _foobar_:'F' /inheritance:d /T

Once this command was executed was is possible to run the delete code

Remove-Item -Path $Module -Recurse -Force -Confirm:$false

@nohwnd
Copy link
Member

nohwnd commented Nov 9, 2019

@thuld maybe your system is in a different language and the Administrators group name is localized to that language?

@thuld
Copy link

thuld commented Nov 27, 2019

@nohwnd You are right. My lang. is DE.

@nohwnd
Copy link
Member

nohwnd commented Dec 8, 2019

@thuld I fixed the deletion script in wiki to use SID and not the group name, and also updated my public gist that does the same thing. Thanks for pointing this out.

@nohwnd nohwnd closed this as completed Dec 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants