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

Unable to install new version of pester using Install-Module -> https://pester.dev/docs/introduction/installation #42

Closed
jahnavi175 opened this issue Apr 16, 2020 · 20 comments · Fixed by #43

Comments

@jahnavi175
Copy link

jahnavi175 commented Apr 16, 2020

Hi Team,
As mentioned in https://pester.dev/docs/introduction/installation , the deletion of existing version needs to be done to install the new version. The code for deleting the current one works but the installation fails. There is some fault in the code with pester. Install-Module Pester -Force -SkipPublisherCheck used to work earlier, also the update-module pester, almost a month ago, now it says, pester is not installed using install-module and cannot be updated. Its so annoying. I currently have 3.4.0 version and need 4.10.0. Suggest me how to.Please reply.

After deletion happens through
*$module = "C:\Program Files\WindowsPowerShell\Modules\Pester"
takeown /F $module /A /R
icacls $module /reset
icacls $module /grant "S-1-5-32-544:F" /inheritance:d /T
Remove-Item -Path $module -Recurse -Force -Confirm:$false
Install-Module -Name Pester -Force

It gives me this error and results in not having pester of any version because it deletes existing one and doesn't install new version
Capture1

Thank you.

@nohwnd
Copy link
Member

nohwnd commented Apr 16, 2020

Could you try updating your PowershellGet module?

@jahnavi175
Copy link
Author

jahnavi175 commented Apr 16, 2020

Could you try updating your PowershellGet module?

Hi @nohwnd I tried that also, it gives me the error similar to the one mentioned earlier.
Please have a look at the error

updatepsget

@vexx32
Copy link
Contributor

vexx32 commented Apr 16, 2020

@jahnavi175 yeah you'll need to do an Install-Module PowerShellGet -Force if I recall correctly?

@jahnavi175
Copy link
Author

@jahnavi175 yeah you'll need to do an Install-Module PowerShellGet -Force if I recall correctly?

Hi @vexx32 . I need to update from pester 3.4.0 to 4.10.1. But its actually not happening. I tried adding -Force parameter also but of no use.

Once have a look at this
impf

@vexx32
Copy link
Contributor

vexx32 commented Apr 16, 2020

I think that's a TLS issue?

Try running this and then retrying the install:

[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor [System.Net.SecurityProtocol]::Tls12

@jahnavi175
Copy link
Author

@vexx32
neww

@vexx32
Copy link
Contributor

vexx32 commented Apr 16, 2020

Yep, just need to pass an extra flag or two to install-module.

Install-Module Pester -Force -SkipPublisherCheck

The certs for the current version differ because Microsoft published and signed the in-box version of Pester, but they're not doing that anymore. 🙂

@jahnavi175
Copy link
Author

@vexx32 whats the main reason and logic behind it can you pls explain why it worked after this
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor [System.Net.SecurityProtocol]::Tls12

@jahnavi175
Copy link
Author

Yep, just need to pass an extra flag or two to install-module.

Install-Module Pester -Force -SkipPublisherCheck

The certs for the current version differ because Microsoft published and signed the in-box version of Pester, but they're not doing that anymore. 🙂

Yess it worked...Thanks a lot..!!

@vexx32
Copy link
Contributor

vexx32 commented Apr 16, 2020

@jahnavi175 depending on your OS and PowerShell versions, TLS 1.2 may not be used by default for Install-Module.

Last... month...ish? The PS folks updated the PowerShell Gallery repository to require TLS 1.2. I think they're working on relaxing that a little, so they still support TLS 1.2 for folks who are using it, but don't require it. But clearly they haven't got that sorted yet.

That code just tells PowerShell / .NET to permit TLS 1.2 to be used for SSL communications. 🙂

@nohwnd
Copy link
Member

nohwnd commented Apr 17, 2020

@vexx32 would you consider updating the docs with this, please?

@nohwnd
Copy link
Member

nohwnd commented Apr 17, 2020

I don't think it ships with 2016 server anymore, and also not with 2019. The removal is not necessary if you specify -Force (and in some cases -SkipPublisherCheck, depending on the PowerShellGet version). Please consider updating that info if you update that article. Thx.

@jahnavi175
Copy link
Author

jahnavi175 commented Apr 17, 2020

I don't think it ships with 2016 server anymore, and also not with 2019. The removal is not necessary if you specify -Force (and in some cases -SkipPublisherCheck, depending on the PowerShellGet version). Please consider updating that info if you update that article. Thx.

Once Have a look at this. I have run these on my new server.
psgetvrsn

Pester is updating to new version only when I am using this command [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocolType -bor [System.Net.SecurityProtocolType]::Tls12
Followed by Install-Module Pester -Force -SkipPublisherCheck

@nohwnd
Copy link
Member

nohwnd commented Apr 17, 2020

Okay so it (Pester) still ships with 2016. The problem with tls is external to Pester, but it is nice to have it in docs.

@vexx32
Copy link
Contributor

vexx32 commented Apr 17, 2020

Yeah, I can update that. The PS folks are supposedly working on fixing the TLS issue, but it might be an issue again in future for all we know.

@jahnavi175
Copy link
Author

Hi @nohwnd @vexx32 , As you said earlier, Microsoft have stopped signing the new versions of pester. May I know the reason why they have stopped it? Also, If I Install my Pester Forcefully through -SkipPublisherCheck, wont that be a threat for my server using the non trusted and unsigned 3rd Party Modules ?

@vexx32
Copy link
Contributor

vexx32 commented Apr 20, 2020

It's not unsigned. It's just signed by a different person since the effective ownership of the module changed, that's all the warning's telling you.

Pester has always been a community module. It's popular enough that Microsoft decided they wanted to ship a version of it with Windows. To do so, they had to sign the code themselves. IMO there's no more risk having a newer version of Pester on your server than there is having the old version that MS signed off on. If you're worried you can look at the code, it's all PowerShell script after all, everything's pretty well in the open there, and it's open source anyway. 🙂

@nohwnd
Copy link
Member

nohwnd commented Apr 20, 2020

@jahnavi175 @vexx32 You can also look at it this way:

Most other modules are unsigned, so they give you no guarantee about the publisher, so there is no publisher to change and you get no warning.

The "risk" levels are like this, from the most risky:

  • unsigned module
  • signed module that "changed" publishers
  • signed module that has a publisher

The first item on the list is an unsigned module, and I bet that the majority of modules you use are unsigned.

So while you get the publisher warning, it still is not less safe than using an unsigned module. My certificate is valid, and issued by a trusted certification authority. 🙂

@jahnavi175
Copy link
Author

jahnavi175 commented Apr 22, 2020

@nohwnd Can You pls let me know who is the trusted certification authority who is signing the Pester version 4.10.1. Please confirm if 4.10.1 is a stable release that can be used.

@nohwnd
Copy link
Member

nohwnd commented Sep 27, 2020

@jahnavi175 the certification authority is DigiCert, and it is me signing the module. Yes, 4.10.1 is a stable release.

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

Successfully merging a pull request may close this issue.

3 participants