PSPKI icon indicating copy to clipboard operation
PSPKI copied to clipboard

Typedata error when importing PSPKI module at console session

Open hmiller10 opened this issue 4 years ago • 2 comments
trafficstars

I received this error when importing the PSPKI module, version 3.7.2, from an elevated PowerShell session.

PS C:\scripts> ipmo pspki Update-TypeData : Error in TypeData "System.Security.Cryptography.Oid": The member ToString is already present. At C:\Program Files\WindowsPowerShell\Modules\pspki\3.7.2\PSPKI.psm1:287 char:5

  • Update-TypeData -AppendPath $PSScriptRoot\Types\PSPKI.PS5Types.ps ...
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [Update-TypeData], RuntimeException
    • FullyQualifiedErrorId : TypesXmlUpdateException,Microsoft.PowerShell.Commands.UpdateTypeDataCommand

I have never received this before. Even after running Remove-Module PSPKI and re-importing the module the same error appears. What is happening to cause this error to be thrown?

hmiller10 avatar Oct 11 '21 17:10 hmiller10

Note: Import-Module -Name PSPKI in an ISE console does not throw any errors.

hmiller10 avatar Oct 11 '21 17:10 hmiller10

As a temporary fix, you can comment this block in PSPKI.psm1 file: https://github.com/PKISolutions/PSPKI/blob/4522ee48755450f3129352f029bfdb9c484f2dd9/PSPKI/PSPKI.psm1#L289

Crypt32 avatar Oct 12 '21 09:10 Crypt32

Closed as stale.

Crypt32 avatar Sep 18 '23 07:09 Crypt32