SAPIEN Information Center
The Effect of SkipPublisherCheck
The SkipPublisherCheck parameter of the Install-Module cmdlet in PowerShellGet technically affects only the current installation. But, its effect is actually more persistent and involves some security risk. In this article, we'll talk about SkipPublisherCheck and signing modules for PowerShell Gallery.
This article is based on PowerShellGet 22.214.171.124 on Windows PowerShell 5.1.14393.953.
Thanks to Mani Bavandla and Matt Graeber for help with this article.
What's the Error?
While creating a new VM in our office, I tried to install a new version of Pester, but got this somewhat familiar error. It says that the version of Pester that we're trying to install (4.0.2) in not digitally signed by its author or publisher.
It ends with a possible fix. If you still want to install this unsigned module, use the SkipPublisherCheck parameter.
PS C:> Install-Module Pester -Force -AllowClobber PackageManagement\Install-Package : The version '4.0.2' of the module 'Pester' being installed is not catalog signed. Ensure that the version '4.0.2' of the module 'Pester' has the catalog file 'Pester.cat' and signed with the same publisher 'CN=Microsoft Root Certificate Authority 2010, O=Microsoft Corporation, L=Redmond, S=Washington, C=US' as the previously-installed module '4.0.2' with version '3.4.0' under the directory 'C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0'. If you still want to install or update, use -SkipPublisherCheck parameter. ...
You Cannot Remove That Module
I've been doing a presentation called Avoiding Version Chaos in a Multi-Version World. I start by explaining that you shouldn't avoid our new multi-version world -- you'll miss out on too much innovation -- but you need to be keenly aware of how it works and understand how to manage it.
For example, your shared code should run perfectly even when the end-user's session includes multiple versions of commands and modules, and commands with the same name in different modules and module versions. There are lots of ways to avoid conflicts, including knowing which commands run by default, understanding what Import-Module imports, removing conflicting module versions (Get-Module Foo | Remove-Module), and using module-qualified commands, version parameters, and the amazing ModuleSpecification object.
Take Values from the Pipeline in PowerShell
In Windows PowerShell, the command pipeline is magic that lets us string together simple, easily understood commands into a complex command with significant power. It makes generic commands, like Get-Item, Sort-Object, and Set-Content function like true reusable parts, so custom commands never need to create them.
To make a pipeline work, the output of one command must be the input to the next command. This article explains how to write parameters that take input from other commands in the pipeline. We'll go step-by-step and explain the details.
Step 1: Simple function
Let's start with a very simple function. This one takes a directory and sums the size of the files inside. It ignores subdirectories and it doesn't verify that the $Directory is a directory and not a file, but I want to keep it simple.
Rebuild in PowerShell HelpWriter: Two ways to update help from code
The Rebuild feature creates a new XML help file for an existing help project. You use the Rebuild feature when the code in your module changes or a new version of the module becomes available.
Rebuild examines the code in your module, gathers the cmdlet attributes, parameters, and parameter attributes from the code and creates a new help file. When you're done rebuilding, the XML help file accurately reflects the current state of the module code.
It's really important to understand that Rebuild creates a new XML help file that replaces your existing XML help file (although we always keep a backup). It is not an update or merge (although those features are on our to-do list.).
So, before you rebuild, you need to make sure that the help file that you've been writing is added to the module that the rebuild is targeting. Want the details? See Writing XML Help for Advanced Functions.