question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The term 'Get-PfxData' is not recognized

See original GitHub issue
  • 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):

??  Cannot get publisher name using powershell: Exit code: 1. Command failed: po
wershell.exe (Get-PfxData "C:\folderName\Cert.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:\folderName\Cert.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!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
MariaDimacommented, Aug 11, 2017

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:\Data\Certificates\Mine\xxx.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:\Data\Certificates\Mine\xxx.pfx

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

1reaction
MariaDimacommented, Aug 10, 2017

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).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Get-PfxData (pki) - Microsoft Learn
The Get-PfxData cmdlet extracts the content of a Personal Information Exchange (PFX) file into a structure that contains the end entity certificate, ...
Read more >
Powershell script doesn't run on first execution - Stack Overflow
I will definetely have a look at the stated documentation but do you really think that the issue of not beeing executed at...
Read more >
Managing Windows PFX certificates through PowerShell
The Get-PfxData cmdlet extracts the contents of a Personal Information Exchange (PFX) file into a structure that contains the end entity ...
Read more >
Import PFX Certificate via PowerShell with full certificate chain
I've used Get-PfxData to verify that the PFX does indeed contain the full chain. I've also tried the following approach: Import manually to...
Read more >
HowTo: Create self-signed certificates with PowerShell 4.0
So let's have some PowerShell fun with certificates! Working with the PKI Module. To create a self-signed certificate with PowerShell, you can ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found