Electron-builder: The term 'Get-PfxData' is not recognized

Created on 9 Aug 2017  路  7Comments  路  Source: electron-userland/electron-builder


  • Version: 19.19.1

  • electron-updater Version: 2.8.2

  • Target: Windows 32bit


My machine is Window 7 64bit.
I'm trying to create a signed Windows installer and getting this error (this is part of the stack trace):

```Packaging for win32 ia32 using electron 1.6.11 to distwin-ia32-unpacked
?? Cannot get publisher name using powershell: Exit code: 1. Command failed: po
wershell.exe (Get-PfxData "C:folderNameCert.p12" -Password (ConvertTo-Secu
reString -String 703fa6866ccb2fc53079d5d244c86c442363aa29fdf3627e00c204af9bb7b00
c (sha256 hash) -Force -AsPlainText)).EndEntityCertificates.Subject
Get-PfxData : The term 'Get-PfxData' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At line:1 char:2

  • (Get-PfxData "C:folderNameCert.p12" -Password (ConvertTo-SecureString
    -Str ...
  • ~~~

    • CategoryInfo : ObjectNotFound: (Get-PfxData:String) [], Command

      NotFoundException

    • FullyQualifiedErrorId : CommandNotFoundException

      ```

Someone mentioned here that Get-PfxData is only available from Windows 8.1. Does that mean that code signing is not supported on Windows 7?

I can sign the installer with signtool.exe, but then the auto update won't work, as it will cause a checksum mismatch.
I also tried to download the last version of powershell from the github repo, with no success.

Thanks for your help!

question

All 7 comments

What's the version of your powershell (execute $psversiontable)?

Check https://blogs.technet.microsoft.com/heyscriptingguy/2013/06/02/weekend-scripter-install-powershell-3-0-on-windows-7/ for upgrading (moving to powershell 4 would be better, but powershell 3 should also work).

Name Value ---- ----- PSVersion 4.0 WSManStackVersion 3.0 SerializationVersion 1.1.0.1 CLRVersion 4.0.30319.42000 BuildVersion 6.3.9600.16406 PSCompatibleVersions {1.0, 2.0, 3.0, 4.0} PSRemotingProtocolVersion 2.2

Get-PfxData is unrecognized...

Looking at this page, it seems like the Get-PfxData is indeed unavailable for Windows 7.
Is it not documented anywhere that code signing isn't supported on Windows 7?
I wonder why signtool.exe isn't used instead...
What are my options? Just create the installer in a window 8+ machine?

What are my options? Just create the installer in a window 8+ machine?

Set https://github.com/electron-userland/electron-builder/wiki/Options#WinBuildOptions-publisherName

Yes, you are right.
The PKI module is available with Windows 8 and up.

But the build does not fail on my windows 7 machine and I haven't set the publisherName on my own.
I'm still trying to understand how it is and I don't face the same problem as you.
My output:
Tue, 08 Aug 2017 11:41:09 GMT electron-builder Executing powershell.exe (Get-PfxData "C:DataCertificatesMinexxx.pfx" -Password (ConvertTo-SecureString -String xxx (sha256 hash) -Force -AsPlainText)).EndEntityCertificates.Subject
Tue, 08 Aug 2017 11:41:10 GMT electron-builder The string is missing the terminator: ".
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : TerminatorExpectedAtEndOfString

Tue, 08 Aug 2017 11:41:10 GMT electron-builder Executing openssl pkcs12 -nokeys -nodes -passin pass:xxx (sha256 hash) -nomacver -clcerts -in C:DataCertificatesMinexxx.pfx

While, indeed, when I execute "Get-PfxData" on powershell, I get the unknow command error.

Setting publisherName resolves it. Thanks everyone!

I am getting same issue, can you please tell me where i need to set "publisherName"?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jhg picture jhg  路  3Comments

JohnWeisz picture JohnWeisz  路  3Comments

noahprince22 picture noahprince22  路  3Comments

xingoxu picture xingoxu  路  3Comments

antonycourtney picture antonycourtney  路  3Comments